Shadow Root


Solution for “Shadow-root” elements, for example some “accept cookies” pages:

To treat these elements we need to use the executeJavascript function, for example:

Document.getElementById(“usercentrics-root”).shadowRoot.querySelector(“[data-testid=uc-accept-all-button]”).click();

The steps to follow are the following:

  1. Find the element that includes shadow-root (document.getElementById(“usercentrics-root”))
  2. Navigate to shadow-root (.shadowRoot)
  3. Navigate to the element with querySelector (.querySelector(“[data-testid=uc-accept-all-button]”))
  4. Interact with the element (.click())