************************ Different Locators in Selenium ***************************
id, name, className, tagName, linkText, partialLinkText, CSS selector and Xpath
If you are using @locatorName then we have to use = operator and if you are using contains method
then we have to use comma ,
//a[text()='Mobiles']
Name:
Same we can write with ID locator
//input[@id='email']
//button[@type='button' and @class='btn btn-primary' and text()='Primary']
Another example:
//a[text()='HImansu']//parent::td//preceding-sibling::td//div[@class='ui fitted read-only
checkbox']//input[@type='checkbox']
CSS Selectors
1. Id → htmltag#id, #id
2. Class → htmltag.classname, .classname, .classname1.classname2…. classname n
3. Parent > childtag
Contains in CSS
Starting text in CSS
Ending text in CSS
First-of-type in CSS
Last-of-type in CSS
Nth-of-type in CSS
Sibling of element