Tuesday, September 27, 2022

implicit and explicit wait

 implicit wait can be declared globally to all elements for a time period.

so no need to keep Thread.Sleep()


driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5);


explicit wait, to increase timeout for individual elements.Like to increase more time for a parituclar element than globbal element.


WebDriverWait wait= new WebDriverWait(driver,TimeSpan.FromSeconds(10)); //from selenium support package


Also install below package.




wait.Until(SeleniumExtras.WaitHelpers.ExpectedConditions.TextToBePresentInElementValue(driver.FindElement(By.XPath("//input[@value='Sign In']")),"Sign In"))


No comments:

Post a Comment