This shows you the differences between two versions of the page.
|
en:shadow-root [2021/08/25 06:17] montse |
— (current) | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ======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: | ||
| - | |||
| - | - Find the element that includes shadow-root (document.getElementById(“usercentrics-root”)) | ||
| - | - Navigate to shadow-root (.shadowRoot) | ||
| - | - Navigate to the element with querySelector (.querySelector(“[data-testid=uc-accept-all-button]”)) | ||
| - | - Interact with the element (.click()) | ||