Skip to main content

You are here

Implicit Wait

Navigation using the browser Back or Front button

The following code programmatically clicks on the browser's "Front" or "Back" navigation buttons to move between visited pages. Between each navigation is a brief waiting period to slow the process down so its noticeable.

Waiting for conditions to be available

While testing a very slow loading website, the dreaded "NoSuchElementException" exception can occur even though the element does exist on the page. The problem can be that the code is running faster than the site loads. The "ExpectedCondition" class ensures that the program waits for a designated period of time before throwing the "NoSuchElementException" error message.

In the code below, we navigate to craigslist, take 5 seconds to wait for the required element to appear and be ready for clicking. Then click the element.

Premium Drupal Themes by Adaptivethemes