user5731250
user5731250

Reputation:

Selenium C#: Adding explicitwait function

I am trying to add an explicit wait function to my project but I am receiving an error

namespace AutoProj
{
    enum PropertyType
    {
        Id,
        Name,
        LinkText,
        CssName,
        ClassName
    }

    class PropertiesCollection
    {
        //autoimplemented properties
        public static IWebDriver driver { get; set; }
    }

main.cs

[TestFixture(typeof(FirefoxDriver))]

[TestFixture(typeof(InternetExplorerDriver))]
[TestFixture(typeof(ChromeDriver))]
public class TestWithMultipleBrowsers<TWebDriver> where TWebDriver : IWebDriver, new()
        {

          [Test]
          public void TestCase_Abc()
          {
            WebDriverWait wait = new WebDriverWait(PropertiesCollection.driver, 1000) ;

Error at (PropertiesCollection.driver, 1000). Am I missing something in here?

Error Description:

Error 1: The best overloaded method match for 'OpenQA.Selenium.Support.UI.WebDriverWait.WebDriverWait(OpenQA.Selenium.IWebDriver, System.TimeSpan)' has some invalid arguments

Error 2: Cannot convert fron 'int' to 'System.TimeSpan'

Upvotes: 3

Views: 734

Answers (1)

Guy
Guy

Reputation: 50809

  • Your PropertiesCollection class is private (default in C#), make it public (it looks like separate classes from what you posted).
  • WebDriverWait gets time span new WebDriverWait(PropertiesCollection.driver, TimeSpan.FromSeconds(10));

Upvotes: 1

Related Questions