Web Automation Template
Introduction
This document provides a comprehensive guide on using the Web Automation Template for streamlining web interactions. The template is structured to define and execute web automation steps in a systematic and efficient manner.
Template Structure
The template follows a structured format to outline the automation steps:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
Each component of the template is explained below:
PAGE_NAME: Refers to the property file that contains web element locators. It is used to organize and reference the elements needed for automation steps on a specific page.
WAIT_TYPE: Defines the condition to wait for before performing an action, such as waiting for an element to be visible or a specific time delay.
SCROLL_TYPE: Indicates if scrolling is required on the page, and the type of scroll action needed.
ELEMENT_NAME: Names the web element that is the target of the action, such as a button, link, or input field.
ACTIONS: Describes the action to be performed on the web element, like clicking, loading a URL, or sending keys.
SEND_KEYS: Details any text or keys to be sent to the web element, applicable in actions like form filling.
VALIDATION: Outlines the expected result or output for validation after the action is performed.
VALIDATION_TYPE: Specifies the method of validation, like checking for equality, string contains, etc.
Example Use Case
Here are step-by-step examples using the template:
NONE
NONE
NONE
NONE
LOAD_URL
NONE
NONE
SwagLabs
VISIBILITY
NONE
pageTitle
NONE
NONE
Swag Labs
EQUAL_IGNORE
LOAD_URL Action
Format:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
Example:
NONE,NONE,NONE,NONE,LOAD_URL,https://www.saucedemo.com/,NONE,NONE
Page Title Validation
Format:
PAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
Example:
SwagLabs,VISIBILITY,NONE,pageTitle,NONE,NONE,Swag Labs,EQUAL_IGNORE
Description: This step waits for the visibility of the 'SwagLabs' page title and validates that it matches "Swag Labs".
Best Practices
Always name your property files(PAGE_NAME) and web elements(ELEMENT_NAME) clearly and descriptively to ensure clarity in automation scripts.
Accurately set WAIT_TYPE to prevent flakiness due to timing issues.
Implement VALIDATION steps to ensure each action achieves the expected outcome.
Troubleshooting
Problem: Actions not executing as anticipated.
Solution: Check that the
ELEMENT_NAME
corresponds correctly to the locator in thePAGE_NAME
property file and thatWAIT_TYPE
is set properly.
Problem: Validation steps not passing.
Solution: Confirm that the expected result in
VALIDATION
matches the actual result and thatVALIDATION_TYPE
is appropriate for the test case.
File
Last updated
Was this helpful?