About Testlum
Getting Started
General Features
Api Testing
Database Testing
Services Testing
Additional Materials
Powered By

Title
Message
Create new category
What is the title of your new category?
Edit page index title
What is the title of the page index?
Edit category
What is the new title of your category?
Edit link
What is the new title and URL of your link?
Locators
Copy Markdown
Open in ChatGPT
Open in Claude
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.
XML
x
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.knubisoft.com/testlum/testing/model/pages" xsi:schemaLocation="http://www.knubisoft.com/testlum/testing/model/pages pages.xsd"></page>- Fill in the
<details>tag, enter the name, URL, and description information about this page.
XML
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.knubisoft.com/testlum/testing/model/pages" xsi:schemaLocation="http://www.knubisoft.com/testlum/testing/model/pages pages.xsd"> <details> <name>name_of_the_file_with_locators</name> <url>url_for_which_locators_are_written</url> <description>description_of_the_file_with_locators</description> </details> </page>- You can also use a component locator file inside a page locator file:
XML
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.knubisoft.com/testlum/testing/model/pages" xsi:schemaLocation="http://www.knubisoft.com/testlum/testing/model/pages pages.xsd"> <details> <name>name_of_the_file_with_locators</name> <url>url_for_which_locators_are_written</url> <description>description_of_the_file_with_locators</description> </details> <include component="header.xml"/> - inclusion of all locators that are in the header.xml file in loginPages.xml, accordingly, the path to these files will begin with loginPages(an example of a file name from the pages folder) <locators> <locator locatorId="username"> <id>LoginName</id> </locator> </page>- After the
<details>block, open the<locators>tag where you can write an unlimited number of<locator>.
XML
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.knubisoft.com/testlum/testing/model/pages" xsi:schemaLocation="http://www.knubisoft.com/testlum/testing/model/pages pages.xsd"> <details> <name>name_of_the_file_with_locators</name> <url>url_for_which_locators_are_written</url> <description>description_of_the_file_with_locators</description> </details> <locators> <locator locatorId=""> < </locator> <locator locatorId=""> < </locator> </locators> </page>- To give a unique name to the locator’s element, which must start with a lowercase letter (e.g: emailField).
XML
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.knubisoft.com/testlum/testing/model/pages" xsi:schemaLocation="http://www.knubisoft.com/testlum/testing/model/pages pages.xsd"> <locators> <locator locatorId="emailField"> - a unique name of the locator < </locator> </locators> </page>- To set a type of the locator ( id, xpath, class, etc.).
XML
<page xmlns="http://www.knubisoft.com/testlum/testing/model/pages"> <locators> <locator locatorId="emailField"> - a unique name of the locator <xpath></xpath> - xpath type </locator> </locators> </page>- Fill in the selected locator type.
XML
<page xmlns="http://www.knubisoft.com/testlum/testing/model/pages"> <locators> <locator locatorId="emailField"> - a unique name of the locator <xpath>.//input[@type='email']</xpath> - selected value of interaction </locator> </locators> </page>Now you can use your locator -loginPages.emailFieldfor any command you need, and for any test.
An example of using locatorId in a command:
XML
<click comment = "Click on 'email' button" locator="loginPages.emailField"/> - path to desired elementAfter 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.
XML
<click comment = "Click on 'email' button" locator="" locatorStrategy=""/>- Select the required locator type (locatorId - is default value, which there is no need to write).
XML
<click comment = "Click on 'email' button" locator="" locatorStrategy="xpath"/> - the type of locator that will be in the locator field- Write locator in the 'locator' field.
XML
<click comment = "Click on 'email' button" locator="//input[@type='email']" locatorStrategy="xpath"/>Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard
Last updated on
Next to read:
Collecting locators with RecorderCopyright © Knubisoft
Discard Changes
Do you want to discard your current changes and overwrite with the template?
Archive Synced Block
Message
Create new Template
What is this template's title?
Delete Template
Message