Skip to content

[🐛 Bug]: switchFrame only works for bidi #13776

@ShannonH

Description

@ShannonH

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

latest

Node.js Version

20.14.0

Mode

WDIO Testrunner

Which capabilities are you using?

capabilities: [{
        'wdio:enforceWebDriverClassic': true,
        browserName: 'chrome'
    }],

What happened?

Getting an error when trying to use switchFrame passing in something that has to be queried like a selector or url: Failed to execute WebDriver Bidi command "browsingContextGetTree" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.

What is your expected behavior?

switchFrame should work without bidi enabled

How to reproduce the bug.

To reproduce:

  1. Create a wdio project
  2. In wdio.conf.ts, update the capabilities to use 'wdio:enforceWebDriverClassic': true
  3. Add a page object for something with iframe
  4. Add a method that switches to the iframe using a url or frame element parameter
  5. Use the new method in a wdio test

I have a sample repo at https://github.com/ShannonH/wdio-test-repo where I've done the above already using the same 'the-internet' app and sample code from the docs to switch to the iframe on the page using the iframe's url (it might be the wrong url, but the error happens on the query)

Relevant log output

[chrome 130.0.6723.59 mac #0-0] Running: chrome (v130.0.6723.59) on mac
[chrome 130.0.6723.59 mac #0-0] Session ID: 734f51e68eaaab8549222b10790d4726
[chrome 130.0.6723.59 mac #0-0]
[chrome 130.0.6723.59 mac #0-0] » /test/specs/test.e2e.ts
[chrome 130.0.6723.59 mac #0-0] My Login application
[chrome 130.0.6723.59 mac #0-0]     should login with valid credentials
[chrome 130.0.6723.59 mac #0-0]     should switch to iframes
[chrome 130.0.6723.59 mac #0-0]
[chrome 130.0.6723.59 mac #0-0] 1 passing (2.1s)
[chrome 130.0.6723.59 mac #0-0] 1 failing
[chrome 130.0.6723.59 mac #0-0]
[chrome 130.0.6723.59 mac #0-0] 1) My Login application should switch to iframes
[chrome 130.0.6723.59 mac #0-0] Failed to execute WebDriver Bidi command "browsingContextGetTree" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.
[chrome 130.0.6723.59 mac #0-0] Error: Failed to execute WebDriver Bidi command "browsingContextGetTree" as no Bidi session was established. Make sure you enable it by setting "webSocketUrl: true" in your capabilities and verify that your environment and browser supports it.
[chrome 130.0.6723.59 mac #0-0]     at iFramePage.switchToFrame (/Users/shannon.harris/work/wdio-test-repo/test/pageobjects/iframe.page.ts:21:9)
[chrome 130.0.6723.59 mac #0-0]     at iFramePage.assertEditorContent (/Users/shannon.harris/work/wdio-test-repo/test/pageobjects/iframe.page.ts:16:9)
[chrome 130.0.6723.59 mac #0-0]     at Context.<anonymous> (/Users/shannon.harris/work/wdio-test-repo/test/specs/test.e2e.ts:18:9)


Spec Files:      0 passed, 1 failed, 1 total (100% completed) in 00:00:04

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