Finding objects or elements in Webpages is the main job while coding with Selenium.You can get Locators from here by which you can uniquely locate your elements in webpage.
The different locator can be..
- Class Name
- Tag Name
- Link Text
- Partial Link Text
Here is a pyramid or thumb rule to determine the mandatory properties to select locators that can uniquely determine an element in the webpage.
The thumb rule says:
Try to get id/Name first to identify an object using developer console. If developer has not provided these then go for Secondary locator that is Xpath,CSS,Index etc to identify an object or element uniquely. If you fail to get first 2 then go with Composite locator or assistive locator to determine an object or element uniquely.
Let me know if you like the post. Please share this if you liked it. Also please feel free to comment.