Basic GuiWidget Locators¶
Following are the basic locators supported and corresponding Selenium By locators.
The locator strategy in GNS files is expressed using locator type names supported by Arjuna. These are simple locators and hence are expressed as basic key value pairs, almost equivalent to the way you pass them as keyword arguments in app.element calls. Functionality is equivalent as well.
id Locator¶
Locates a GuiWidget by the content of its id attribute.
Coded
app.element(id="user_login")
GNS
user_id:
id: user_login
name Locator¶
Locates a GuiWidget by the content of its name attribute.
Coded
app.element(name="log")
GNS
user_name:
name: log
classes Locator¶
Locates a GuiWidget by a class name contained in its class attribute. For more advanced usage, see locator_exts.
Coded
app.element(classes="cls")
GNS
user_class:
classes: input
link Locator¶
Locates a GuiWidget by its PARTIAL link text.
app.element(link="password")
GNS
lost_pass_link:
link: password
flink Locator¶
Locates a GuiWidget by its FULL link text.
Coded
app.element(flink="Lost your password?")
GNS
lost_pass_flink:
flink: "Lost your password?"
xpath Locator¶
Locates a GuiWidget by the specifield XML Path (xpath).
Coded
app.element(xpath="//*[contains(text(), 'Lost')]")
GNS
lost_pass_text_content:
xpath: "//*[contains(text(), 'Lost')]"
selector Locator¶
Locates a GuiWidget by the specifield CSS Selector.
Coded
app.element(selector=".button.button-large")
GNS
button_compound_class:
selector: ".button.button-large"