3

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'

1 Answer 1

1
  • 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));
Sign up to request clarification or add additional context in comments.

7 Comments

Another question: I am receiving error at nest line. at until and ExpectedCondition wait.until(ExcepctedConditions.elementToBeClickable(NextTab)); Do you know why?
[FindsBy(How = How.LinkText, Using = "Next Tab")] public IWebElement NextTab { get; set; }
@AJ1110 in C# it should be wait.Until(ExpectedConditions.ElementIsClickable(By.LinkText(""Next Tab")));
Note the capital letter in ElementIsClickable and Until
'OpenQA.Selenium.Support.UI.ExpectedConditions' does not contain a definition for 'ElementIsClickable'
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.