Activity: Creating an Explicit Wait

  1. Review and analyze the DOM of the https://trainingbypackt.github.io/Beginning-Selenium/lesson_5/exercise_5_1.html file, and see how elements are affected by the functionality of this file
  2. Create a Selenium test that clicks on the available button:
driver.findElement(By.id("runTestButton")).click();
  1. Choose any of the elements whose attribute values are changed after clicking on the test button. Create an explicit wait for the chosen object:
WebDriverWait wait = new WebDriverWait(driver, 5);
wait.until(ExpectedConditions.titleContains("Explicit"));
  1. For each of the instructions in step 4, check the contents of the title:
if (driver.getTitle().startsWith("Explicit")) {
System.out.println("ExplicitWait worked, the element contains 'Explicit'");
} else {
System.out.println("Something went wrong with ExplicitWait, 'Explicit' was not found");
}
  1. Compile and run the test.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.141.202