×
☰ See All Chapters

How to locate element by tag name locator in selenium

If a tag is used only once in a web page, then it can be used for tag name locator. If there are multiple same tags, selenium always locates the first matching element. Below is the syntax and example for tag name locator:

Syntax:

tagName=name of the tag

Example:

tagName=select

Note: There should be no space/emptyspce before and after = (equals)

Let us test tag name locator from our test page Test Page

selenium-tagname-locator-0
 
selenium-tagname-locator-1
 

All Chapters
Author