To wait for a page to load, or display some element, what methods or functions can be used?

958    Asked by MelanyDoi in QA Testing , Asked on Jan 9, 2020
Answered by Ashish Mishra

The unequivocal trust that a page will stack. It holds the page when some particular condition is met. Thread.sleep() is a type of an explicit wait but this is certainly not a solid method to hold the page. For instance, as opposed to utilizing:

Thread.Sleep(20000);

… here the thread sleeps for 20 seconds (20,000 milliseconds), the following can be used:

WebDriverWait waitObj= new WebDriverWait(webDriver,20);

waitObj.until(ExpectedConditions.visibilityOf(h1));

… where Selenium holds the page until the given element is visible.



Your Answer

Interviews

Parent Categories