GUI Automation Framework Documentation
GUI Automation Framework Documentation
GUI Automation Framework Documentation
//tagname[@Attribute = 'Value']
//div[@class = 'class-name']
Using Attribute:
//tagname[contains(@Attribute, 'Value')]
//div[contains(@class, 'part-of-the-class-value')]
Using Text:
//tagname[contains(text(), 'Value')]
//div//p[contains(text(), 'Part of the text')]
Locate elements that starts-with part of a text in Attribute:
Sometimes the Attribute values are too large so we can target a web element using the
starts-with() function to write only the first part of the Attribute value, we can use the following
format:
Using Attribute:
//tagname[starts-with(@Attribute, 'Value')]
//div[starts-with(@class, 'first-part-of-the-value')]
Using Text:
//tagname[contains(text(), 'Value')]
//div//p[contains(text(), 'First part of the text')]
//tagname[@Attribute = 'Value']//following::tagname
//div[@class = 'class-name']//following::input
//tagname[@Attribute = 'Value']//ancestor::tagname
//input[@class = 'class-name']//ancestor::div
Locate elements using child::
To target all the child (son) web elements from a element with a specific tagname, we can use
the following format:
//tagname[@Attribute = 'Value']//child::tagname
//div[@class = 'class-name']//child::label
//tagname[@Attribute = 'Value']//preceding::tagname
//div[@class = 'class-name']//preceding::input
//tagname[@Attribute = 'Value']//following-sibling::tagname
//div[@class = 'class-name']//following-sibling::input
//tagname[@Attribute = 'Value']//parent::tagname
//button[@class = 'class-name']//parent::div
//button[@class = 'class-name']//parent::div[1]