Skip to content

[πŸ› Bug]: It can't open Closed Shadow RootsΒ #14796

@graysuit

Description

@graysuit

What happened?

It can't open the closed shadow roots.
It works with undetected selenium c#, but not here.
In dotnet, I use like:

                Driver.ExecuteCdpCommand("Page.addScriptToEvaluateOnNewDocument", New Dictionary(Of String, Object) From {{"source", "
                Element.prototype._as = Element.prototype.attachShadow;
                Element.prototype.attachShadow = function (params) {
                    return this._as({mode: ""open""})
                };
            "}})

How can we reproduce the issue?

Here's my code to reproduce the bug

from seleniumbase import Driver
import os
import time

def getDriver(Intercept=True, Eager=True, Headless=False, Profile="Default", Argument=""):
    Binary = "C:/Program Files/Slimjet/chromium.exe" # Slimjet Version 38.0.9.0 (based on Chromium 109.0.5414.74) (Official Build) (64-bit)
    userDir = f'C:/Users/{os.environ.get("USERNAME")}/AppData/Local/Slimjet/User Data'
        
    Args = f'--disable-web-security,--ignore-certificate-errors,--hide-crash-restore-bubble,--profile-directory={Profile},{Argument}'
    return {
        'binary_location': Binary,
        'uc_cdp_events': Intercept,
        'uc': True,
        'headless': Headless,
        'chromium_arg': Args,
        'user_data_dir': userDir,
    }

headless = False
profile = "Default"
argument = ""
driver = Driver(**getDriver(Intercept=False, Eager=True, Headless=headless, Profile=profile, Argument=argument))
open_all_closed_shadow_roots(driver)
driver.execute_cdp_cmd(
            "Page.addScriptToEvaluateOnNewDocument", 
            {
                "source": """
                Element.prototype._as = Element.prototype.attachShadow;
                Element.prototype.attachShadow = function (params) {
                    return this._as({mode: "open"});
                };
                """
            }
        )
driver.open("https://www.faysalbank.com")
time.sleep(10)
driver.quit()


### Relevant log output

```shell
N/A

Operating System

Windows 10

Selenium version

Python 3.12.5

What are the browser(s) and version(s) where you see this issue?

Slimjet 38.0.9.0 SeleniumBase Latest

What are the browser driver(s) and version(s) where you see this issue?

Chromedriver 109.0.5414.74

Are you using Selenium Grid?

N/A

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-needs-triagingA Selenium member will evaluate this soon!I-defectSomething is not working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions