Time for action - finding elements by ID - Selenium

Elements often have IDs that are used to locate them. In the Target textbox this would look like id=Element .Follow the given example to see how it would work:

  1. Open Selenium IDE.

  2. Navigate to http://book.theautomatedtester.co.uk/chapter(Locators) and click on the Firebug icon.

  3. Find any element that you want to interact with on the page and in the Target textbox of Selenium IDE,place its ID attribute value.
    Make sure that it has an ID attribute.For example,use butl as in the previous screenshot against http: //book.theautomatedtester.co.uk/chapter(locators).

  4. Type the command click into the Command selectbox.

  5. Play your script.

What just happened?

Your test will have executed the step successfully. Since the test is using the ID of the element, if that element were to be moved around, it would find the item without any issue. This is one of the main plus points of Selenium over a lot of the competing test frameworks out there.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Selenium Topics