//button |
Element selector |
//button[contains(@class,'btn-primary')] |
Button with a class |
/*[@id='myId'] |
Exact match of id |
//button[@id='saveButton'] |
Button with an id |
//*[contains(@id,'myId')] |
Contains the id |
//*[contains(@class,'myClass')] |
Has class |
//*[@data-testid='myTestId'] |
Match attribute |
//*[contains(@data-testid,'myTestId')] |
Contains attribute |
//td[contains(@data-testid,'Customer') and contains(@data-testid, 'list-item')]/div |
Contains attribute with child |
//*[starts-with(@data-testid,'save')] |
Starts with |
//*[substring(@data-testid, string-length(@data-testid) - string-length('button') + 1) = 'button'] |
Ends with |
//button[@data-testid='save-button'] |
Button with attribute |
//*[@id='customerForm']//input |
Id with all descendants |
//*[contains(@class,'customer-container')]//input |
Class with all descendants |
//*[@data-testid='customer-form']//input |
Attribute with all descendants |
//*[@id='customerForm']/button |
Direct child |
//[@id='saveButton']/following-sibling::[1][self::button] |
Sibling |
//buttÂon[.//ÂspaÂn[nÂormÂaliÂze-ÂspaÂce(.)=Â'Close Modal']] |
Button that has span with text |
//button[contains(normalize-space(.), 'CONTINUE')] |
Button that has any text inside |
(//div[contains(@class,'list-item')])[2] |
Select the second matching div |
|
Reference |
Created By
https://github.com/GregFinzer
Metadata
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets
More Cheat Sheets by GregFinzer