Reputation: 139
Earlier i used to use Expected Conditions class to wait for an element to display.
Since ExpectedConditions class is obselete now, I am using the below piece of code to specify my webdriver to wait for 30 seconds beforing throwing no such element exception. Is this code valid and meaningful? If not, please suggest the usage.
WebDriver wait = new WebDriverWait(driver, TimeSpan.FromSeconds(30));
wait.Until(d=>driver.FindElement(By.ID("")).Displayed);
Upvotes: 1
Views: 1955
Reputation: 31
Go to "NuGet package manager" and install DotNetSeleniumExtras.WaitHelpers and then you will be able to use wait condition like, wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.UrlContains(URL));
Upvotes: 3