Time for action - finding elements by name - Selenium

Elements do not necessarily have ID attributes on all of them. Elements can have names that we can use to locate them.In the Target text box this would look like name = Element. Follow the given example to see how it would work:

  1. Open Selenium IDE.

  2. Navigate to http ://www.wisdomjobs.com/chapter(Locators)and click on the Firebug icon.

  3. Find any element that you want to interact with and in the Target textbox of Selenium IDE, place the value of its name attribute.For example, use but2 as in the following screen shot against http://book.the automatedtester.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 name of the element, if that element were to be moved around,it would find the item without any issue.

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

Selenium Topics