O'Reilly logo

Selenium 2 Testing Tools Beginner's Guide by David Burns

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – using implicit waits

In this section we will see how we can use implicit waits in our code. We need to change a number of calls together to set the implicit. This was done to keep the API as succinct as possible:

  1. Open your Java IDE. Intellij or Eclipse are the most used.
  2. We are going to use the command:
    driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    driver.findElement(By.xpath("//div[@id='ajaxdiv']")
  3. Run your tests:
    Time for action – using implicit waits

What just happened?

We have just seen that our tests run and pass. We didn't have to do anything special for waiting for the new text to appear on the page. Let's go see how we can do this with the explicit ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required