Book Image

Selenium Essentials

By : Prashanth Sams
Book Image

Selenium Essentials

By: Prashanth Sams

Overview of this book

Table of Contents (12 chapters)

Handling Ajax websites

Every modern web application makes use of Ajax calls that return data through asynchronous calls made to the web server. It avoids page reload and updates part of the web page at any time. Let's see how to manage these Ajax-based websites through Selenium WebDriver in detail.

The isElementPresent method

The isElementPresent() method is a user-defined method that checks for an element's availability within a web page. By default, the Selenium IDE generates the following script, where the object returns a Boolean value (however, this method is not recommended for handling Ajax-based web apps):

private boolean isElementPresent(By by) {
  try {
    return true;
  } catch (NoSuchElementException e) {
    return false;

public void Test01() throws Exception {
  Boolean a = isElementPresent("q"));
  Boolean b = isElementPresent("selenium_essentials"));...