๐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_NAMEis the filename of the properties file without the extension. For example,SwagLabsrefers toSwagLabs.properties.ELEMENT_NAMEis 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.errorUsage 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, NONENotes
When the automation script runs, it looks up the
ELEMENT_NAMEin the correspondingPAGE_NAME.propertiesfile 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_NAMEis not present in thePAGE_NAME.propertiesthen automation throw below exception:
Demo
Last updated
Was this helpful?