Driving Element Selection with Variables

Element Selection with Variables Overview

Driving Element Selection refers to the process of choosing or identifying the key factors or components that will significantly impact selecting and/or interacting with a specific web object as part of a test case. With Functionize, you can rely on the default machine learning (ML) data to drive your element selection, or you can assist the default selection by providing a specific text string related to the object you want to interact with, obtained in an earlier test step and stored as a Local or Project Variable. This document outlines how to set up and drive element selection using variables effectively.

Setting Up Element Selection Using Variables

Step 1: Create a SetVariable Action

  1. Store Text in Variable: Create a SetVariable Action to store the text that will be used in a later test action to drive its element selection. This can be a Local or Project Variable.
    • Example: Action #1.2 captures the text 'USE CASES' from the menu object on the webpage into the Local Variable overrideText.

Step 2: Capture Text During Test Execution

  1. Capture Text: During test execution, capture the required text from the web object and store it in the Local Variable.
    • Example: Action #1.2 captures the text 'USE CASES' from the menu object into the Local Variable overrideText.

Step 3: Override Default ML Selection with Variable

  1. Advanced Tab Configuration: At the step where you need to override the default ML selection, provide the Variable expression {{fze.local.overrideText}} in the Text field under the Miscellaneous section in the Advanced Tab.
    • Example: In Action #1.3, use the Variable {{fze.local.overrideText}} to drive the element selection.

Step 4: Verify Test Recording

  1. ARC Screenshot on Slider View: During test recording, verify the recorded action in the ARC screenshot on the Slider view.
    • Example: Action #1.3 was recorded selecting the 'PRODUCT' menu.

Step 5: Execute and Verify Test

  1. Test Execution Verification: During test execution, verify that the element selection override from the Local Variable is working as expected.
    • Example: At Action #1.3, the test verifies that the 'USE CASES' menu is not equal to 'PRODUCT', using the element selection override from the Local Variable.

Cross-Browser Compatibility

Functionize ensures that the element selectors work across different browsers. However, some browsers may interpret selectors differently. It's important to test your selectors if you require execution across multiple browsers to ensure compatibility.

By following these steps, you can effectively set up and drive element selection using Variables in Functionize, enhancing the precision and flexibility of your test automation process.