ScriptlessAutomation
  • 👋Welcome to Scriptless Automation
  • Discover More About Automation
    • ⚙️Automation platform intro
    • 💡Advantages of Scriptless Automation
    • 🚀Release Notes
      • 📖Open Code
      • 📕License Code
  • Product tools
    • 📪Pre-request Tools
    • 🔧Project Dependencies
  • Automation Architecture
    • 🎨Flow diagram
  • Get Started
    • 🛠️Start with Automation
    • 📖Open Code Automation
      • 🌏Web Automation
      • ↔️API Automation
    • 🏢Maven Configuration
    • 🗜️Setting Up Maven Project in IntelliJ IDEA
    • 🎛️Scriptless Config
      • 🕸️BrowserConfiguration
        • chrome.properties
      • 👥CommunicationConfiguration
        • SlackConfiguration.properties
      • 📧MailConfiguration
        • gmailCredentials.properties
      • 🛂ReportConfiguration
        • extentReportConfiguration.properties
      • 🕵️TestManagementConfiguration
        • testRail.properties
        • zephyrscale.properties
        • testiny.properties
      • ⚙️testNgConfiguration.properties
    • 🍱TestData Configuration
    • 👨‍💼Gherkin Language and Scriptless Automation Framework
  • Automation Import Notes
    • 🎨Points to Remember
  • Automation Platforms
    • 👾ScriptlessApi Automation
      • 🖊️Introduction
      • 🗜️Api Automation Setup
      • 🔃Supported API Request Types
      • 🪧API Automation Template
      • 📚Example of API Requests
        • ⬇️GET
        • ↕️POST
        • ⤵️PUT
        • ❌DELETE
      • 🎯API Response Validation
      • 👨‍👦API Dependent TestCase
      • 📝Store API Variables
      • 📔API with JSON body
      • 🙋‍♂️Api Wait
      • 🗜️API Schema Validation
      • 🏗️API Tailor-Made coding
      • 👨‍🦯API Support Generator
      • ↘️Api Response Store Objects
      • ✍️API Test Report
      • 🚃Api Response Type Validation
    • 🌐ScriptlessWeb Automation
      • 🖊️Introduction
      • 🗜️Web Automation Setup
      • 🪧Web Automation Template
      • 🧮page_object_locators
      • 📜Web Automation Key Phrases
        • 📃PAGE_NAME
        • ⌛WAIT_TYPE
        • 📜SCROLL_TYPE
        • 👨‍💼ELEMENT_NAME
        • 🏎️ACTIONS
        • ⌨️SEND_KEYS
        • ✔️VALIDATION
        • ✅VALIDATION_TYPE
      • 👨‍👦Web Dependent Test Case
      • 🐒MOCK
      • 🛂AutomationAsserts
      • 🏗️Web Tailor-Made coding
      • 📝Store Web Variables
      • 🤼‍♀️Web & API integration
      • 🖇️Dynamic Strings
      • 🗣️ReadFile Annotation for Custom Code
      • 🖼️Page_Comparison
      • 👨‍💼Gherkin Template for Web Automation
    • 📱Mobile Automation
  • 🪶Automation features
    • 🌲Environment and System Variables
    • 🗝️KeyInitializers
      • Types of KeyInitializers
    • ✍️Reporting
      • Dashboard
      • Category
      • Tests
        • Screenshot Section
    • 👯Parallel Testing
    • 🏗️Tailor-Made Coding
  • ⏩Automation Demo
Powered by GitBook
On this page
  • Introduction
  • Directory Structure
  • Defining Locators
  • Using Locators in Web Templates
  • Supported Selector Types

Was this helpful?

  1. Automation Platforms
  2. ScriptlessWeb Automation

page_object_locators

Introduction

This guide provides detailed instructions on how to set up and use page object locators for web automation in Scriptless Automation. It includes the structure for storing locators, how to define them, and how to use them in web templates.

Directory Structure

The locators for web pages should be stored in a dedicated directory within your test data folder. The recommended structure is as follows:

project
   └── test_data
       └── web
           └── page_object_locators
               └── gmail.properties

Defining Locators

Locators should be defined in properties files. Each property represents a locator with its unique identifier and the type of selector used.

Locator syntax should be follow as below

elementName = SelectorType -> selector

Example: gmail.properties

# Locator definitions for Gmail
email = XPATH -> //*[@id="identifierId"]

In this example:

  • email is the name of the element i.e. elementName.

  • XPATH is the type of selector used to locate the element i.e. selectorType.

  • //*[@id="identifierId"] is the actual XPath expression to locate the element i.e. selector.

  • elementName and SelectorType define another locator with a generic name and type.

Using Locators in Web Templates

Web templates use these locators to perform actions on the web elements. Each action is defined in a CSV file that specifies the page name, wait type, scroll type, element name, action to be performed, value to be sent, validation, and validation type.

Example: Web Template

csvCopy codePAGE_NAME,WAIT_TYPE,SCROLL_TYPE,ELEMENT_NAME,ACTIONS,SEND_KEYS,VALIDATION,VALIDATION_TYPE
gmail,NONE,NONE,NONE,LOAD_URL,https://www.gmail.com/,NONE,NONE
gmail,VISIBILITY,NONE,email,SEND_KEYS,john depth,NONE,NONE

In this example:

  • The first row loads the Gmail URL.

  • The second row waits for the visibility of the email element and then sends the text john depth to it.

Supported Selector Types

The following types of selectors are supported:

  • ID: Selects elements based on their unique ID attribute.

  • NAME: Selects elements based on their name attribute.

  • CLASS_NAME: Selects elements based on their class attribute.

  • TAG_NAME: Selects elements based on their tag name.

  • LINK_TEXT: Selects anchor elements with the exact visible text.

  • PARTIAL_LINK_TEXT: Selects anchor elements containing the specified partial text.

  • XPATH: Selects elements using XPath expressions.

  • CSS: Selects elements using CSS selectors.

PreviousWeb Automation TemplateNextWeb Automation Key Phrases

Last updated 1 year ago

Was this helpful?

🌐
🧮