Waiting for elements to appear on the page

Web applications now want to appear as though they are desktop applications as more and more people move to hardware, such as tablets or netbooks, which have very small hard drives. This is all done through AJAX to the page.

This means that when we are working with Selenium WebDriver, we need to have it synchronized with what is happening on the page. We do not want to use something like Thread.sleep()because this doesn't make our tests run as quickly as possible. We need to use one of the next two approaches: implicit or explicit waits.

Implicit waits

Selenium WebDriver borrowed the idea of implicit waits from Watir. This means that we can tell Selenium that we would like it to wait until the particular ...

Get Learning Selenium Testing Tools - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.