Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get Selenium to wait for a transition page to redirect before running an assertion

I have a fairly standard situation: Click a button, it loads a transition page with a progress bar or something, and then that page redirects to the next page, which takes a while to load.

I want to run assertions on the final page, not the transition page. How do I tell Selenium IDE to wait till the final page loads before performing the assertions?

Thank you.

like image 858
marc esher Avatar asked Jan 06 '10 15:01

marc esher


People also ask

Which method is used to wait until the page is loaded completely?

We can wait until the page is completely loaded in Selenium webdriver by using the JavaScript Executor. Selenium can run JavaScript commands with the help of the executeScript method.

How do you wait for text in Selenium?

Wait until text is present in the specified element findElement(By.id("element-id")); WebDriverWait wait = new WebDriverWait(driver, 10); wait. until(ExpectedConditions. textToBePresentInElement(element, "text")); If you go to the given link above, you will see all the wait condition there.

Which wait statement will be used to wait till page load?

Explicit Wait The explicit wait is used to tell the Web Driver to wait for certain conditions (Expected Conditions) or the maximum time exceeded before throwing an "ElementNotVisibleException" exception.


1 Answers

A simple approach would be wait for some "particular" text on that final page, see "waitForText" command for further info on it

like image 178
John Avatar answered Oct 18 '22 07:10

John