codeceptjs / codeceptjs/CodeceptJS

unable to enter iframe via switchTo(iframeID or iframeName) in edge and mobile chrome browser

Open
#1,851 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
4.2k
Forks
757
Avg merge
2d 9h
Merged PRs (30d)
16

Description

#### What are you trying to achieve?
enter iframe using I.switchTo(#iframe) with Microsoft Edge browser or Chrome on Android
#### What do you get instead?

> Provide console output if related. Use `--verbose` mode for more details.

```bash
# error when executed in Edge browser
# also frame was found by I.waitForElement() in previous step:

The specified frame was not found in the current frame or window.
no such frame: The specified frame was not found in the current frame or window.
at getErrorFromResponseBody (/Users/wolf/WebstormProjects/newCodeceptJS/node_modules/webdriver/build/utils.js:215:10)
at Request._callback (/Users/wolf/WebstormProjects/newCodeceptJS/node_modules/webdriver/build/request.js:103:64)
at Request.self.callback (/Users/wolf/WebstormProjects/newCodeceptJS/node_modules/request/request.js:185:22)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at Request. (/Users/wolf/WebstormProjects/newCodeceptJS/node_modules/request/request.js:1161:10)
at Request.emit (events.js:198:13)
at Request.EventEmitter.emit (domain.js:448:20)
at IncomingMessage. (/Users/wolf/WebstormProjects/newCodeceptJS/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:286:20)

Scenario Steps:
- I.switchTo({"frame":"#ds24_heidelpay_cc_iframe"}) at Test.Scenario (ClassicOrderform_test.js:247:7)
- I.waitForElement({"frame":"#ds24_heidelpay_cc_iframe"}) at Test.Scenario (ClassicOrderform_test.js:246:7)

# -------------
# error when executed in Mobile Chrome on Android phone
# also frame was found by I.waitForElement() in previous step:

Error: invalid argument: missing 'ELEMENT'
(Session info: chrome=74.0.3729.136)
(Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 3.19.8-100.fc20.x86_64 x86_64)
at getErrorFromResponseBody (node_modules/webdriver/build/utils.js:215:10)
at Request._callback (node_modules/webdriver/build/request.js:103:64)
at Request.self.callback (node_modules/request/request.js:185:22)
at Request.EventEmitter.emit (domain.js:448:20)
at Request. (node_modules/request/request.js:1161:10)
at Request.EventEmitter.emit (domain.js:448:20)
at IncomingMessage. (node_modules/request/request.js:1083:12)

Scenario Steps:
- I.switchTo({"frame":"#ds24_heidelpay_cc_iframe"}) at Test.Scenario (ClassicOrderform_test.js:247:7)
- I.waitForElement({"frame":"#ds24_heidelpay_cc_iframe"}) at Test.Scenario (ClassicOrderform_test.js:246:7)

```

> identified workaround for both browsers

```js
// Step to fail:
I.switchTo('#iframeID');

// workaround for Edge and Chrome on Android browser via helper class:
await this.helpers["WebDriver"].browser.switchToFrame('iframeID'); //without #
```

### Details

* CodeceptJS version: 2.3.0 and before
* WebDriverIO: 5.10.9
*[Appium] Creating new AndroidDriver (v1.24.1)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.