
Title
Page icon
Create new category
Edit page index title
Edit category
Edit link
Locators
Before describing the WEB related commands, it is necessary to know how to create a locator and connect it to a scenario.
Available types of locators:
id
class
xpath
cssSelector
text
Locator for commands can be written in two types:
locator - locators are created in special folders with names that can be used in different scenarios without duplicating the entire locator.
Directly in the field for the locator - the locator is entered in the field in its entirety each time.
To create locators for the l__ocator field you need:
To create a file in the locators folder with the name of the page or component (e.g: loginPages.xml)
component folder - contains files from page components that do not change according to the page (it can be a footer, a header). Also, for use, these locators must be included in the pages file required for use;
pages folder - contains files of different pages that change according to the link.
All files with locators have the required scheme format inside this file.
Fill in the
<details>tag, enter the name, URL, and description information about this page.
You can also use a component locator file inside a page locator file:
After the
<details>block, open the<locators>tag where you can write an unlimited number of<locator>.
To give a unique name to the locator’s element, which must start with a lowercase letter (e.g: emailField).
To set a type of the locator ( id, xpath, class, etc.).
Fill in the selected locator type.
Now you can use your locator -loginPages.emailFieldfor any command you need, and for any test.
An example of using locatorId in a command:
After the element locator= "" - we’re paving the way to the locator we need in the format filename.locatorId.
To write locators directly in the field for the locator you need:
Use the locatorStrategy attribute in each command that you need.
Select the required locator type (locatorId - is default value, which there is no need to write).
Write locator in the 'locator' field.
Copyright © Knubisoft