Course Content
Selenium Python First Script
Selenium Python First Script
0/2
HTML Form elements
HTML Form elements
0/1
Handle HTML Frames
Handle HTML Frames
0/2
Handling Dropdown Lists
Handling Dropdown Lists
0/2
Selenium Action class
Selenium Action class
0/1
Selenium Python for Beginners [ 2024 ]
About Lesson

ID and NAME

ID and NAME are straightforward location strategies in Selenium. You can use these HTML attributes to identify the elements on the web page.

ID

ID is the attribute of an HTML element. We can use this attribute to identify the object uniquely. 

The easiest and quickest method is to locate an element on a web page by its ID. However, the IDs need to be unique and fixed on the page. Without unique IDs, you must opt for other alternate locator techniques.

id=

NAME

NAME is also an attribute of an HTML element. Use the browser developer tools to inspect and look up the HTML source code of the elements. 

When the web element’s ID is unavailable, the best alternative is to locate it using its Name attribute.

name=

Examples

The two HTML elements below have the name attributes. You can use the NAME location strategy to identify them on the webpage.

<input type=”text” name=”username”/>

<input type=”password” name=”password”/>

Join the conversation