Skip to content

[🐛 Bug]: switchFrame() doesn't always accept promise #13856

@gavvvr

Description

@gavvvr

Have you read the Contributing Guidelines on issues?

WebdriverIO Version

v9.2.8

Node.js Version

v22.6.0

Mode

Standalone Mode

Which capabilities are you using?

{
    browserName: 'electron',
    browserVersion: '33.0.0',
    'wdio:electronServiceOptions': {
        appArgs: []
    }
}

What happened?

The await browser.switchFrame($('iframe')) will fail in Electron app test setup with wdio-electron-service with the following error:

WebDriverError: invalid argument: missing 'ELEMENT'

What is your expected behavior?

Based on switchFrame() WDIO docs and existing test in E2E test suite, the following construct should work with no errors:

await browser.switchFrame($('iframe'))

How to reproduce the bug.

Here is the repo to reproduce the problem: https://github.com/gavvvr/wdio-electron-service-818

Relevant log output

[0-0] 2024-11-05T22:00:38.362Z ERROR webdriver: WebDriverError: invalid argument: missing 'ELEMENT'
[0-0]   (Session info: chrome=130.0.6723.59) when running "frame" with method "POST" and args "{"id":{}}"
[0-0] invalid argument in "My Login application.should reset the frame when the page is reloaded"
invalid argument: WebDriverError: invalid argument: missing 'ELEMENT'
  (Session info: chrome=130.0.6723.59) when running "frame" with method "POST" and args "{"id":{}}"
    at async Context.<anonymous> (/Users/user/Documents/sandboxes/wdio-electron-iframe-ts/test/specs/test.e2e.ts:4:5

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

Assignees

No one assigned

    Labels

    Bug 🐛help wantedIssues that are free to take by anyone interested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions