📃PAGE_NAME

Definition of PAGE_NAME

In the context of web automation scripts, PAGE_NAME refers to a property file that contains locators for web elements. These locators are used in automation scripts to interact with the corresponding elements on a web page.

Relationship Between PAGE_NAME and ELEMENT_NAME

  • PAGE_NAME is the filename of the properties file without the extension. For example, SwagLabs refers to SwagLabs.properties.

  • ELEMENT_NAME is the identifier used within the property file to refer to a specific web element.

Example: SwagLabs.properties File

In the SwagLabs.properties file, web elements are defined with their respective locators:

pageTitle = CSS -> .login_logo
userName = CSS -> #user-name
password = CSS -> #password
loginButton = CSS -> .btn_action
errorMessage = CSS -> .error-message-container.error

Usage in Automation Scripts

In an automation script, you reference PAGE_NAME and ELEMENT_NAME to perform actions on those elements. For example:

PAGE_NAME, WAIT_TYPE, SCROLL_TYPE, ELEMENT_NAME, ACTIONS, SEND_KEYS, VALIDATION, VALIDATION_TYPE
SwagLabs, VISIBILITY, NONE, userName, SEND_KEYS, testuser, NONE, NONE
SwagLabs, VISIBILITY, NONE, password, SEND_KEYS, testpassword, NONE, NONE

Notes

  • When the automation script runs, it looks up the ELEMENT_NAME in the corresponding PAGE_NAME.properties file to find the locator.

  • This modular approach allows for easy maintenance and updates to element locators without changing the automation scripts.

  • If the given ELEMENT_NAME is not present in the PAGE_NAME.properties then automation throw below exception:

main.java.com.precisiontestautomation.exception.handling.PrecisionTestException: Failed While running test case search  Element name "page" is not present in SwagLabs.properties | Cannot invoke "String.split(String)" because the return value of "main.java.com.precisiontestautomation.automation.elementgenerator.GetLocators.getLocatorValue(String, String)" is null

Demo

Last updated

Was this helpful?