Details of Locating elements by ID - Selenium Webdriver Trainings

Selenium has become the most sought after test automation tool in the world for testing web based applications. As the use of selenium has increased the demand for selenium experts has also increased. In order to cater to the ever increasing demand, many selenium testing training courses have come up and many ambitious persons have started pursuing the course as it helps them to get better career opportunities.

Selenium videos, that are provided by the trainers as a part of the study materials will cover the entire process of testing step by step. Simple and easy to understand narrations and the supporting infographics will help the students to learn the subject more clearly and without the help of a third person.

One of the most important stages of selenium testing process is to locate elements, as it is necessary if you want to perform some actions on the elements. In selenium webdriver, there are many locators such as locate elements by name, class, link etc and one of the most important locator is locating elements by ID.

Locating element by ID

This process will be taught in detail in locating element by ID tutorial which is an integral part of selenium testing training courses. If the software web application page has a unique and static ID you can use this locator to locate this element.


This can be used to find out whether the page has a unique and static id or not. If it is available, you can use locating element with ID. We can provide you with many locating elements by ID and one of the is provided below.

public void test() {
 driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
 for (int i = 0; i<=20; i++)
  WebElement  btn = driver.findElement(“submitButton”));//Locating element by id
  if (btn.isEnabled())
   //if webelement’s attribute found enabled then this code will be executed.
   System.out.print(“\nCongr8s… Button is enabled and webdriver is clicking on it now”);

  //Locating button by id and then clicking on it.
   //if webelement’s attribute found disabled then this code will be executed.
   System.out.print(“\nSorry but Button is disabled right now..”);
  try {
  } catch (InterruptedException e) {

Hope you have got the basic idea on locate elements with ID and also how to locate element with ID in selenium webdriver. You will get a chance to learn this part of the course in detail if you join in selenium webdriver tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *