-
Notifications
You must be signed in to change notification settings - Fork 10
Locators File
Márcio Mendes edited this page Oct 30, 2017
·
5 revisions
The Locators File is used to map all important elements from your tested website. For this you need to inform the elements using this two nodes:
-
container
- A page or its part (use this for better organization).- name - Define a specific name for your container
- locators - Each container may contain a list of locators
-
locator
- Represents an element in a page (textbox, button, link etc.).- key - Define a specific key for each element/locator
-
type - Set the type of interaction with element (model, xpath, id etc). see list
- Obs: If you need to use the parameterized interaction write p: before the type ex:
p:xpath
- Obs: If you need to use the parameterized interaction write p: before the type ex:
- value - Inform the value for interaction
-
options (optional) - Define a specific filter for current locator result
-
enabled
: get theisEnabled()
element from list -
displayed
: get theisDisplayed()
element from list -
first
: get the first element from list -
last
: get the last element from list
-
Inside your project, create a folder named locators
and put a file *_locators.json
/locators/demo_qaaut_locators.json
{
"containers": [
{
"name": "Login",
"locators": [
{
"key": "username",
"type": "model",
"value": "login.usuario"
},
{
"key": "password",
"type": "xpath",
"value": "//input[@placeholder='Senha']"
},
{
"key": "btnEntrar",
"type": "buttonText",
"value": "Entrar"
},
{
"key": "buttonByText",
"type": "p:xpath",
"value": "//button[text()='{0}']",
"options": "enabled"
}
]
},
{
"name": "Menu",
"locators": [
{
"key": "Navigate",
"type": "p:linktext",
"value": "{0}"
},
{
"key": "SubMenu",
"type": "p:xpath",
"value": "(//span[text()='{0}'])[2]"
}
]
}
]
}