1

Below is my code , and it works fine

 public static void WaitTillthisclassName(string elemantName, int TimefromMSeconds)
        {
            WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(TimefromMSeconds));
            wait.Until(ExpectedConditions.ElementExists(By.ClassName(elemantName)));

        }

But at there im passing elemantName as string I need to pass a IWebElement type elemantName.

how am i going to do this?

And i also tried passing IWebElemant ,but got bellow errors. enter image description here

1 Answer 1

1
 public static void WaitTillthisclassName(IWebElement element, int TimefromMSeconds)
        {
            WebDriverWait wait = new WebDriverWait(Driver, TimeSpan.FromSeconds(TimefromMSeconds));
            wait.Until(ExpectedConditions.ElementExists((OpenQA.Selenium‌​.By)element));

        }
11
  • ooh, i did the same ;But some error came to the action,.
    – ChathuD
    Jan 31, 2017 at 5:31
  • Argument 1: cannot convert from 'OpenQA.Selenium.IWebElement' to 'OpenQA.Selenium.By'
    – ChathuD
    Jan 31, 2017 at 5:32
  • seems like ElementExists does not accept IWebElement as param Jan 31, 2017 at 5:45
  • this has no compilation errors, try to see if it works: wait.Until(ExpectedConditions.ElementExists((OpenQA.Selenium.By)element)); Jan 31, 2017 at 5:48
  • Yahya H Hussein it works. Please add as a Answer
    – ChathuD
    Jan 31, 2017 at 5:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.