By methods | Description of the methods |
---|---|
By.id(String id) | Finds element based on the value of the "id" attribute. |
By.name(String name) | Finds element based on the value of the "name" attribute. |
By.linkText(String linkText) | Finds element based on the text inside Tag. |
By.partialLinkText(String linkText) | Finds element based on the partial text inside Tag. |
By.className(String className) | Finds elements based on the value of the "class" attribute. |
By.cssSelector(String selector) | Finds element or elements via the driver's underlying W3 Selector engine. |
By.xpath(String xpathExpression) | Finds element or elements based on the absolute xpath, relative xpath and position xpath. |
By.tagName(String name) | Finds elements based on the Tag. |
xpath | css |
---|---|
//*[@id = 'user'] //*[@id = 'pass'] |
*[id = 'user'] *[id = 'pass'] |
//input[1] //input[2] //input[contains(@class, 'class')][1] //input[contains(@class, 'class')][2] |
div:first-child div:last-child div:nth-child(3) div input div > input div + input label + input |
//input[@id = 'user'] //input[@id = 'pass'] |
input[id = 'user'] input[id = 'pass'] |
//input[starts-with(@name, 'prefix')] //input[starts-with(@name, 'beginning')] |
input[name ^= 'prefix'] input[name ^= 'beginning'] |
//input[ends-with(@name, 'suffix')] //input[ends-with(@name, 'end')] | input[name $= 'suffix'] input[name $= 'end'] |
//input[contains(@name, 'between')] //input[contains(@name, 'middle')] |
input[name *= 'between'] input[name *= 'middle'] |
//a[text() = 'Google'] | a[href*='google'] |
//input[@id='user' and @class='userclass'] //input[@id='pass' and @class='passclass'] |
input[id='user'][class='userclass'] input[id='pass'][class='passclass'] |
//input[@id='user' or @class='userclass'] //input[@id='pass' or @class='passclass'] |
#user #pass input#user input#pass .userclass .passclass input.userclass input.passclass |
No comments:
Post a Comment