Home > Automation Testing > Selenium WebDriver Locator by ID

Selenium WebDriver Locator by ID

This post was most recently updated on August 5th, 2024

Here is example to find element by Locator Type as ID 

  • ID is attribute used with HTML element to uniquely identify it in HTML document. 
  • Faster and easiest way to locate an element in HTML document using selenium. 

How to find web element by using id in Java language

Steps to find ID attribute of web element.

  1. Open url https://www.societyhive.com/  in chrome browser.
  2. Open Developers tool using F12 or Ctrl+Shift+I.
  3. Inspect element by using Ctrl+Shift+C or by clicking on arrow icon in devTools.
  4. Click on input box having placeholder text as “Society name” on web page.

Id attribute in html element.

 

 

 

 

 

Java code to find above element by id attribute is: 

To enter some text in text box 

To clear entered values in Text box

Selenium Tutorial >>

This Article is TAGGED in , , , . BOOKMARK THE permalink.

Avatar photo
Neeraj Vishwakarma
Senior QA Engineer Skills: Automation Testing, Manual Testing, STLC, Java, Selenium Webdriver, Protractor, Database Testing.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">