Validations for WebTesting

Welcome to the comprehensive guide on Web Validations in LoadGen. Navigating the world of automated testing has never been easier. With LoadGen, the process starts with a simple click of the record button. This initiates your chosen browser, and every action you undertake - from clicking buttons to entering text - is accurately recorded.

Once you've completed your actions, stop the recording and replay the sequence either as a block or as an entire application. During the replay, you may occasionally find yourself stuck. This might be due to a need for manual validation insertion. This is where this guide comes in, to help you understand and effectively utilize the functionality of manual web validations in LoadGen.

In this article, we'll dive deep into how you can seamlessly add manual validations, ensuring the reliability of your testing process and bolstering the robustness of your applications. So, let's get started!

General Validation Configuration

LoadGen’s web validation feature allows you to efficiently verify elements on a webpage during your load testing. This feature enables you to check the presence or absence of specific elements, aiding you in making sure your web application behaves as expected under load. This guide will walk you through the steps of configuring your validations, selecting locators, and utilizing various locator types.

Let's begin with the general validation configuration:

  1. Set the validation type to 'Element Found'. This means that the validation process will look for the specified web element.
  2. Set the validation event to either 'Appearance' or 'Disappearance', depending on whether you expect the element to appear or disappear during the load test.
  3. Define the 'Timeout value', this is the time period within which the validation should be completed. You can either input a specific value or select a variable.
  4. Define the 'Initial wait', which is the time before the validation starts. Again, you can either input a specific value or select a variable.

Locator Selection

Once you've set your validation configuration, the next step is to select the control to wait for. LoadGen provides three options:

  1. Static Value: Here, you directly provide the locator value.
  2. Retrieve Locator: This option will bring up the currently opened website where you can click on an item. LoadGen will automatically translate this into a locator. You can see the red crosshair on the selected (search input form) locator.
  3. Create Your Own: The '+' symbol lets you create your own locator. You'll have to choose from the list of locator types that LoadGen offers (we'll cover this in the next section).
  4. Select a Locator from a variable: Choose a predefined locator variable.

Locator Types

Locators are central to Playwright's auto-waiting and retry-ability feature. They represent a way to find elements on the webpage at any given moment. The LoadGen software provides a variety of locator types, allowing you to select elements in numerous ways:

  • GetByRole: Locate by explicit and implicit accessibility attributes.
  • GetByText: Locate by text content.
  • GetByAltText: Locate an element, usually an image, by its text alternative.
  • GetByLabel: Locate a form control by the associated label's text.
  • GetByPlaceHolder: Locate an input by a placeholder.
  • GetByTestId: Locate an element based on its data-test id attribute (other attributes can also be configured).
  • GetByTitle: Locate an element by its title attribute.
  • Filter: Further narrow down your locator by filtering by text, presence of a child or descendant, or absence of specific text or a child/descendant.
  • Locator First: Select the first matching element from a locator.

Each locator type has its specific use cases, and the best one to use depends on the unique needs of your web validation. Locators can be created with the page.locator() method and used in conjunction with filter() to narrow down to the exact element you're looking for.

Locators give you the ability to validate elements based on roles, labels, placeholder text, alt text, titles, and more. This flexibility allows you to fine-tune your load testing and validation to fit the exact specifications of your web application.

Moreover, Locator operators like 'and', 'or', 'isVisible', etc., provide additional ways to manipulate your locator selection. You can chain multiple locators together to narrow down the search to a specific part of the webpage, match two locators simultaneously, match one of the alternative locators, match only visible elements, or chain multiple filters.

Through this comprehensive web validation system, LoadGen allows you to meticulously validate your web application's behavior under various load conditions, ensuring that your app not only performs well but also functions correctly even under high-traffic scenarios.


GetByRole is a powerful function provided by the LoadGen web validation system. It allows you to select HTML elements on a webpage based on their accessibility roles, which is a useful way to interact with components that may be hard to reach through other selectors.

The function provides a wide variety of roles to select from, such as "Time", "Paragraph", "Table", "Radio", "Textbox", and so on. This gives you the flexibility to interact with different types of elements on a page in a way that aligns with web accessibility guidelines. For instance, you could use GetByRole to select all elements with the role "Button" to validate that all buttons on a page are functioning correctly.

Beyond selecting by role, GetByRole also allows you to add extra properties to refine your selection. Some of these properties include:

  • Checked: This property selects interactive elements that have a checked state, such as checkboxes or radio buttons. If an element has been selected or marked by a user (i.e., "checked"), using this property would select that particular element.
  • Disabled: This property selects elements that are currently disabled. Disabled elements are typically interactive components, like input fields or buttons, that have been deactivated to prevent user interaction.
  • Exact: This property ensures that the role you're selecting matches exactly, without allowing any partial matches. This can help narrow your selection when dealing with elements that have similar role names.
  • Expanded: This property is typically used for elements that have collapsible content, like dropdown menus or accordions. When set to true, this property selects elements that are currently expanded. Conversely, when set to false, it selects elements that are currently collapsed.
  • IncludeHidden: This property allows you to include elements that are currently hidden from view. Hidden elements might be UI components that are not currently necessary or relevant to the user's interaction, such as elements in a dropdown menu that haven't been expanded.
  • Level: This property is used for elements that have a hierarchical level, such as headings or tree nodes. It allows you to select elements based on their level in the hierarchy.
  • Name: This property allows you to select elements based on their accessible names. Accessible names are typically provided by the HTML 'title', 'alt', 'aria-label', or 'aria-labelledby' attributes.
  • NameRegex: This property allows you to select elements based on a regular expression pattern match against their accessible names. This is useful when you want to select elements that follow a certain naming convention.
  • NameString: This property is essentially similar to the Name property but may be used in contexts where you want to be explicit about the Name being a string value.
  • Pressed: The pressed property selects elements that are currently in a pressed state. These are typically interactive elements like buttons that have been activated but have not yet been released.
  • Selected: This property is used for selecting elements that are currently selected. It applies to elements in a group where one or more can be selected, like options in a select dropdown or cells in a grid.

Remember that these properties can be used individually or combined to refine your selection of elements based on their roles and states.

Control Configuration in the Validation Wizard

In this step of the validation wizard, you're presented with options to configure how the control behaves once it's been found. You can choose to interact with the control by clicking it or you may choose to do nothing. If you opt for interaction, you will need to specify which mouse button you prefer to use. The choices are either the left button or the right button. This gives you flexibility in defining how the system interacts with the identified control, either initiating an action or simply recognizing its presence. In the example below we will click on the locator if it is found.DN-2308.png

Adding a Measurement in the Validation Wizard

The next step in the validation wizard allows you to add a measurement to your validation process. If you want to encapsulate the validation within a measurement, you can enter a unique name for it in the provided field. However, if you don't want to wrap the validation in a measurement, you can leave the field empty. Note that the measurement name must adhere to certain rules. It should begin with a letter or an underscore and must be at least one character long. The valid characters for the name include letters, numbers, underscores, and spaces. This step provides a method for tracking and categorizing validations, allowing for a more organized and systematic approach to quality assurance. In the example below we will add a name for this measurement so we can measure how long it took for the search locator to appear.


In this example workload, the process begins by navigating to the Google homepage using the "" URL. The system then waits until the page is fully loaded and ready, which is signified by a status of 'NetworkIdle'. After the page is loaded, a measurement titled 'Google search input field found and clicked' is started. This measurement is looking to find and interact with the Google search bar.

To do this, the system waits for a specific element to be located, identified by its role as a 'Combobox' with the accessible name of 'Search'. The system waits for a maximum of 10 seconds and starts searching immediately without any initial delay.

If the locator, which is the specific search box in this case, isn't found within the timeout period, the measurement fails and is terminated. However, if the locator is found within the allotted time, the measurement is successful and is stopped. After successfully locating the search box, the system performs a left click on this last validated locator. This series of actions ensures that the Google search bar is not only located but also interacted with correctly, validating the functionality and responsiveness of the search feature.

Was this article helpful?
0 out of 0 found this helpful