There are some common ways to find locators that are used most of the time in UI Automation. I am listing some of them down so it will expedite the process of writing locators.
1. So if you are looking for an XPath expression to search based on a class and text:
Class is only "myclass":
//*[@class='myclass' and contains(text(),'deepak')]
Class contains "myclass":
//*[contains(@class,'myclass') and contains(text(),'deepak')]
2. Select div that contains class AND whose specific child element contains text
//div[contains(@class, 'measure-tab') and contains(.//span, 'someText')]
3. To determine if a checkbox is checked or not through xpath
//input[@type='checkbox' and @checked]
or
//input[@type='checkbox' and not(@checked)]
//div[contains(@class, 'measure-tab') and contains(.//span, 'someText')]
No comments:
Post a Comment