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 have a significant impact on selecting and/or interacting with a specific web object as part of a test case. With Functionize, you can rely on the default 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/Project Variable. Then, use that Local/Project Variable later in the test case to help drive your element selection. The selection of these driving elements is likely based on their importance to the uniqueness of the web object in achieving the desired outcomes or influencing the overall behavior of the default selection.


Here is sample way to set-up and drive element selection using Variables:

  1. You need a SetVariable Action to store the text that will be used in a later test action to drive it's element selection, again you can create a Local or Project Variable

  2. During test execution, Action #1.2 captures the text 'USE CAES' from the menu object on the webpage into the Local Variable overrideText

  3. Then at the step where you need to override the default ML selection and drive the element selection using the Local Variable from Action #1.2 above, in this step, under the Advanced TAB, provide the Variable expression {{fze.local.overrideText}} in the Text field under the Miscellaneous section

  4. At test recording time, you can see from the ARC screenshot on the Slider view, Action #1.3 was recorded selecting the 'PRODUCT' menu

  5. Then during test execution, you can see at Action #1.3, with the element selection override from the Local Variable, the test verifies the 'USE CASES' menu is not equal to 'PRODUCT'

    Note: Cross-Browser Compatibility - In Functionize, we ensure that the element selectors work across different browsers. But some browsers may interpret selectors differently, so it's important to test if you require to execute your test(s) on multiple browsers.