Skip to main content

About Shadow DOM Settings

guidance

Shadow DOM can hide application elements behind component boundaries, which affects how Scenario Editor identifies and interacts with controls. ReviewA Shadow DOM settingssetting when(forcedShadowDom) selectorshas workbeen on normal pages but fail inside web components.

Whenadded to review these settings

  • Elements are visible but cannot be found during playback.
  • Recorded locators are unstable inside custom components.
  • Self-healing chooses a similar element outside the intendedglobal.json component.
  • file. The applicationdefault framework changed and moved elements into shadow roots.

Maintenance workflow

  1. Confirm the target elementvalue is insidetrue. open or closedThe Shadow DOM.
  2. UseDOM stable labels, accessible names, or application-provided test attributes when possible.
  3. Validate the selectorsetting in the samescript browseroptions in the Test Designer IDE (Set ShadowDOM) will be ignored if the forcedShadowDom is set to true. Even if that option is set to false in the Test Designer IDE, scripts will be run with the option set to true.

    This was added in the 4.10.6 and Test5.0.0 Nodereleases usedof byAIQ.

    the

    Generally scenario.

  4. Updatespeaking, waits and assertions so the componentthere is readyno beforelonger interaction.
  5. Documentany reason for having the Shadow DOM dependenciesoption turned off. Setting it off will not help or prevent any problems or failures. Having it set to off can actually cause failures in instances where a script tries to perform a click action on a element that is under Shadow DOM.

    In previous releases, there may breakhave afterbeen front-endconcerns frameworkof changes.

some potential performance issues when the setting was on versus the setting being off. Those issues have been addressed.

Examples

Any Shadow DOM setting of “true” will result in the test case finding the Shadow DOM elements successfully. However, the setting in the global.json file will always override the option set locally in the test script.

Following are some examples of the script execution results from the various combinations of settings between the forcedShadowDom setting in global.json and the Set ShadowDOM action specified in test scripts.

The example test scripts were recorded using the public Salesforce site which has Shadow DOM elements as shown in the examples.

Example 1

Settings:

     forcedShadowDom in global.json is set to true

    Set ShadowDOM action is not specified in test script

    Expected behavior:

      AIQ should find the Shadow DOM elements and the script execution completes successfully.

      Example 2

      Settings:

        forcedShadoDom in global.json is set to true 

        Set ShadowDOM action in the test script is set to false 

        Expected behavior:

          AIQ should find the Shadow DOM elements and the script execution completes successfully. This is because even though the individual script setting is false, the setting in the global.json file is given priority.

          Example 3

          Settings:

            forcedShadowDom in global.json is set to true

            Set ShadowDOM action in the test script is set to true

            Expected behavior:

              AIQ should find the Shadow DOM elements and the script execution completes successfully. This is because the Shadow DOM property is set to true in both locations.

              Example 4

              Settings:

                forcedShadowDom in global.json is set to false

                Set ShadowDOM action is not specified in test script

                Expected behavior:

                  AIQ will not locate the Shadow DOM elements and the script fails.

                  Example 5

                  Settings:

                    forcedShadowDom in global.json is set to false

                    Set ShadowDOM action in the test script is set to false

                    Expected behavior:

                      AIQ will not locate the Shadow DOM elements and the script fails.

                      Example 6

                      Settings:

                        forcedShadowDom in global.json is set to false

                        Set ShadowDOM action in the test script is set to true

                        Expected behavior:

                          AIQ should find the Shadow DOM elements and the script execution completes successfully.


                          Last updated: OctoberMarch 6,19, 20262024

                          If you have any feedback on this topic, please contact us at documentation@appvance.ai