Skip to content

[🐛 Bug]: Issue with ShadowRootManager after refreshing the page #13467

@Badisi

Description

@Badisi

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v9.0.7 (still exists in v9.0.9)

Node.js Version

v20.15.1

Mode

WDIO Testrunner

Which capabilities are you using?

{
  browserName: 'chrome',
  browserVersion: 'stable',
  maxInstances: 5,
  acceptInsecureCerts: true
}

What happened?

I have a weird behavior where reloading the web page I'm currently on will try registering shadow root elements again, but failed... Resulting in queries to any elements to fail.


The first time the page is loaded we can see that shadow root elements are registered without issues:

INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-main /> with id f.CBE533B5B39838B151E5097253DE2415.d.64E1F3AF651C502FA3D66BD3A2329D1B.e.42
...

But after the page is refreshed (ex: with browser.refresh()), I have this kind of error:

INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-main /> with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.116
ERROR webdriver: Failed parse WebDriver Bidi message: Couldn't find element with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.117
...

And it seems to happen only with this page : https://badisi.github.io/auth-js/demo-app/ngx-auth/.
Because I've tried other pages with shadow-dom like this one : https://www.mdui.org/en/docs/2/components/button/, and it's working without issues.

What is your expected behavior?

No response

How to reproduce the bug.

Simply run this test:

it('test', async () => {
  await browser.url('https://badisi.github.io/auth-js/demo-app/ngx-auth/');
  await browser.refresh();
  await browser.pause(2000);
});

Relevant log output

Execution of 1 workers started at 2024-08-26T20:25:12.972Z

2024-08-26T20:25:12.984Z INFO @wdio/cli:launcher: Run onPrepare hook
2024-08-26T20:25:12.985Z INFO @wdio/utils: Setting up browser driver for: chrome@stable
2024-08-26T20:25:12.997Z INFO @wdio/utils: Setting up browser binaries for: chrome@stable
2024-08-26T20:25:13.126Z INFO webdriver: Using Chromedriver v128.0.6613.84 from cache directory /var/folders/nh/qx9wychn2jzf99lqdw_x7sn40000gp/T
2024-08-26T20:25:13.348Z INFO webdriver: Setting up chrome v128.0.6613.84
2024-08-26T20:25:13.352Z INFO @wdio/cli:launcher: Run onWorkerStart hook
2024-08-26T20:25:13.353Z INFO @wdio/local-runner: Start worker 0-0 with arg: run,wdio.config.ts,--watch=false,--debug=true,--headless=false
2024-08-26T20:25:13.358Z DEBUG @wdio/local-runner: Send command run to worker with cid "0-0"
[0-0] 2024-08-26T20:25:14.188Z INFO @wdio/local-runner: Run worker command: run
[0-0] 2024-08-26T20:25:14.196Z DEBUG @wdio/runner: init remote session
[0-0] RUNNING in chrome - file:///src/specs/test.e2e.ts
[0-0] 2024-08-26T20:25:14.286Z DEBUG @wdio/runner: init remote session
[0-0] 2024-08-26T20:25:14.287Z INFO webdriver: Initiate new session using the WebDriver protocol
[0-0] 2024-08-26T20:25:14.645Z INFO webdriver: Setting up chrome v128.0.6613.84
[0-0] 2024-08-26T20:25:14.648Z INFO webdriver: Using Chromedriver v128.0.6613.84 from cache directory /var/folders/nh/qx9wychn2jzf99lqdw_x7sn40000gp/T
[0-0] 2024-08-26T20:25:14.664Z INFO chromedriver: Starting ChromeDriver 128.0.6613.84 (606aa55c7d687518d34b55accc5a71ea0bd28727-refs/branch-heads/6613@{#1335}) on port 62533
[0-0] 2024-08-26T20:25:14.664Z INFO chromedriver: Remote connections are allowed by an allowlist (0.0.0.0).
[0-0] 2024-08-26T20:25:14.664Z INFO chromedriver: Please see https://chromedriver.chromium.org/security-considerations for suggestions on keeping ChromeDriver safe.
[0-0] 2024-08-26T20:25:14.667Z INFO chromedriver: ChromeDriver was started successfully on port 62533.
[0-0] 2024-08-26T20:25:15.659Z INFO @wdio/utils: Started Chromedriver v128.0.6613.84 with params --port=62533 --allowed-origins=* --allowed-ips=0.0.0.0 in 1371ms on port 62533
[0-0] 2024-08-26T20:25:15.676Z INFO webdriver: [POST] http://localhost:62533/session
[0-0] 2024-08-26T20:25:15.676Z INFO webdriver: DATA {
[0-0]   capabilities: {
[0-0]     alwaysMatch: {
[0-0]       browserName: 'chrome',
[0-0]       browserVersion: 'stable',
[0-0]       acceptInsecureCerts: true,
[0-0]       'goog:chromeOptions': [Object],
[0-0]       webSocketUrl: true
[0-0]     },
[0-0]     firstMatch: [ {} ]
[0-0]   },
[0-0]   desiredCapabilities: {
[0-0]     browserName: 'chrome',
[0-0]     browserVersion: 'stable',
[0-0]     acceptInsecureCerts: true,
[0-0]     'goog:chromeOptions': {
[0-0]       binary: '/var/folders/nh/qx9wychn2jzf99lqdw_x7sn40000gp/T/chrome/mac-128.0.6613.84/chrome-mac-x64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing',
[0-0]       args: [Array]
[0-0]     },
[0-0]     webSocketUrl: true
[0-0]   }
[0-0] }
[0-0] 2024-08-26T20:25:17.062Z INFO webdriver: Register BiDi handler for session with id 7b8122f2d24c8fd6372001c7af6e6d78
[0-0] 2024-08-26T20:25:17.062Z INFO webdriver: Connect to webSocketUrl ws://127.0.0.1:62533/session/7b8122f2d24c8fd6372001c7af6e6d78
[0-0] 2024-08-26T20:25:17.078Z INFO webdriver: Connected session to Bidi protocol
[0-0] 2024-08-26T20:25:17.079Z INFO webdriver: Connected session to Bidi protocol
[0-0] 2024-08-26T20:25:17.079Z INFO webdriver: Connected to WebDriver Bidi interface at ws://127.0.0.1:62533/session/7b8122f2d24c8fd6372001c7af6e6d78
[0-0] 2024-08-26T20:25:17.082Z INFO webdriver: BIDI COMMAND script.addPreloadScript { functionDeclaration: <PreloadScript[868 bytes]>, contexts: undefined }
[0-0] 2024-08-26T20:25:17.083Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.navigationStarted","network.responseCompleted","network.beforeRequestSent","network.fetchError"]}
[0-0] 2024-08-26T20:25:17.084Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.userPromptOpened"]}
[0-0] 2024-08-26T20:25:17.084Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["browsingContext.navigationStarted"]}
[0-0] 2024-08-26T20:25:17.084Z INFO webdriver: BIDI COMMAND session.subscribe {"events":["log.entryAdded"]}
[0-0] 2024-08-26T20:25:17.106Z DEBUG webdriver: BIDI RESULT {"id":3,"result":{},"type":"success"}
[0-0] 2024-08-26T20:25:17.107Z DEBUG webdriver: BIDI RESULT {"id":4,"result":{},"type":"success"}
[0-0] 2024-08-26T20:25:17.107Z DEBUG webdriver: BIDI RESULT {"id":5,"result":{},"type":"success"}
[0-0] 2024-08-26T20:25:17.108Z DEBUG webdriver: BIDI RESULT {"id":1,"result":{"script":"a45a8b3b-a579-4e35-bea0-21b52613dbb4"},"type":"success"}
[0-0] 2024-08-26T20:25:17.111Z DEBUG webdriver: BIDI RESULT {"id":2,"result":{},"type":"success"}
[0-0] 2024-08-26T20:25:17.126Z DEBUG @wdio/utils:shim: Finished to run "beforeTest" hook in 2ms
[0-0] 2024-08-26T20:25:17.128Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:17.128Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:17.132Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:17.132Z INFO webdriver: BIDI COMMAND browsingContext.navigate {"context":"CBE533B5B39838B151E5097253DE2415","url":"https://badisi.github.io/auth-js/demo-app/ngx-auth/","wait":"complete"}
[0-0] 2024-08-26T20:25:17.149Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:17.149Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:17.154Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:17.156Z INFO webdriverio:ContextManager: Update current context: CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:17.514Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:17.514Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:17.516Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:17.676Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-main /> with id f.CBE533B5B39838B151E5097253DE2415.d.64E1F3AF651C502FA3D66BD3A2329D1B.e.42
[0-0] 2024-08-26T20:25:17.679Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-header /> with id f.CBE533B5B39838B151E5097253DE2415.d.64E1F3AF651C502FA3D66BD3A2329D1B.e.44
[0-0] 2024-08-26T20:25:17.684Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-playground /> with id f.CBE533B5B39838B151E5097253DE2415.d.64E1F3AF651C502FA3D66BD3A2329D1B.e.49
[0-0] 2024-08-26T20:25:17.691Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-debug /> with id f.CBE533B5B39838B151E5097253DE2415.d.64E1F3AF651C502FA3D66BD3A2329D1B.e.51
[0-0] 2024-08-26T20:25:17.700Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-settings /> with id f.CBE533B5B39838B151E5097253DE2415.d.64E1F3AF651C502FA3D66BD3A2329D1B.e.62
[0-0] 2024-08-26T20:25:17.802Z DEBUG webdriver: BIDI RESULT {"id":6,"result":{"navigation":"4aad26ff-a90f-44a6-94f0-f98808bf9ccd","url":"https://badisi.github.io/auth-js/demo-app/ngx-auth/"},"type":"success"}
[0-0] 2024-08-26T20:25:17.802Z INFO webdriver: COMMAND refresh()
[0-0] 2024-08-26T20:25:17.802Z INFO webdriver: [POST] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/refresh
[0-0] 2024-08-26T20:25:17.810Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:17.811Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:17.950Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:17.950Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:18.046Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-main /> with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.116
[0-0] 2024-08-26T20:25:18.046Z ERROR webdriver: Failed parse WebDriver Bidi message: Couldn't find element with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.117
[0-0] 2024-08-26T20:25:18.049Z INFO webdriver: RESULT null
[0-0] 2024-08-26T20:25:18.050Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:18.050Z INFO webdriverio:ContextManager: Update current context: CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:18.051Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:18.060Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-header /> with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.118
[0-0] 2024-08-26T20:25:18.060Z ERROR webdriver: Failed parse WebDriver Bidi message: Couldn't find element with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.116
[0-0] 2024-08-26T20:25:18.061Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-playground /> with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.119
[0-0] 2024-08-26T20:25:18.061Z ERROR webdriver: Failed parse WebDriver Bidi message: Couldn't find element with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.117
[0-0] 2024-08-26T20:25:18.067Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-debug /> with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.121
[0-0] 2024-08-26T20:25:18.068Z ERROR webdriver: Failed parse WebDriver Bidi message: Couldn't find element with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.117
[0-0] 2024-08-26T20:25:18.076Z INFO webdriverio:ShadowRootManager: Registered new shadow root for element <demo-app-settings /> with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.122
[0-0] 2024-08-26T20:25:18.077Z ERROR webdriver: Failed parse WebDriver Bidi message: Couldn't find element with id f.CBE533B5B39838B151E5097253DE2415.d.E356085DB1150F458CA71F29C40C24BA.e.117
[0-0] 2024-08-26T20:25:18.110Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:18.111Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:18.116Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:18.457Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:18.457Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:18.460Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:18.466Z INFO webdriver: COMMAND getWindowHandle()
[0-0] 2024-08-26T20:25:18.467Z INFO webdriver: [GET] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78/window
[0-0] 2024-08-26T20:25:18.469Z INFO webdriver: RESULT CBE533B5B39838B151E5097253DE2415
[0-0] 2024-08-26T20:25:20.055Z DEBUG @wdio/utils:shim: Finished to run "after" hook in 0ms
[0-0] 2024-08-26T20:25:20.055Z INFO webdriver: COMMAND deleteSession()
[0-0] 2024-08-26T20:25:20.056Z INFO webdriver: [DELETE] http://localhost:62533/session/7b8122f2d24c8fd6372001c7af6e6d78
[0-0] 2024-08-26T20:25:20.110Z INFO webdriver: RESULT null
[0-0] 2024-08-26T20:25:20.111Z INFO webdriver: Kill driver process with PID 13301
2024-08-26T20:25:20.236Z DEBUG @wdio/local-runner: Runner 0-0 finished with exit code 0
[0-0] PASSED in chrome - file:///src/specs/test.e2e.ts
2024-08-26T20:25:20.237Z INFO @wdio/cli:launcher: Run onWorkerEnd hook
2024-08-26T20:25:20.237Z INFO @wdio/cli:launcher: Run onComplete hook

Code of Conduct

  • I agree to follow this project's Code of Conduct

Is there an existing issue for this?

  • I have searched the existing issues

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions