theintern / leadfoot

A JavaScript client library that brings cross-platform consistency to the Selenium WebDriver API.
Other
170 stars 25 forks source link

switchToFrame errors when given string #186

Closed maxbeatty closed 4 years ago

maxbeatty commented 4 years ago

Expected behavior

If the iframe I am targeting has an id of "card-frame" and a name of "card-frame" and can be accessed through window.frames["card-frame"], should I be able to call switchToFrame("card-frame")?

Current behavior

Currently, an error is thrown:

InvalidArgument: [POST http://localhost:4444/wd/hub/session/a382b5f9b7e1d73deb28a1e03deb265e/frame / {"id":"card-frame"}] invalid argument: 'id' can not be string
      (Session info: chrome=79.0.3945.117)
    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
    System info: host: 'mbeatty-81lvdt.local', ip: '172.28.12.31', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.15.2', java.version: '11.0.3'
    Driver info: driver.version: unknown
      at Server.post @ node_modules/src/Server.ts:361:16
      at runRequest @ node_modules/src/Session.ts:133:12
      @ node_modules/src/Session.ts:167:44
      at new e @ node_modules/@theintern/common/index.js:16:5068
      at InitializedProxiedSession.Session._delegateToServer @ node_modules/src/Session.ts:110:11
      at InitializedProxiedSession.Session.serverPost @ node_modules/src/Session.ts:179:16
      at InitializedProxiedSession.Session.switchToFrame @ node_modules/src/Session.ts:591:16
      at sessionMethod @ node_modules/src/Command.ts:826:43
      at Command.<anonymous> @ node_modules/src/Command.ts:844:30
      @ node_modules/@theintern/common/index.js:16:7174
      at Command._callSessionMethod @ node_modules/src/Command.ts:811:11
      at Command.switchToFrame @ node_modules/src/Command.ts:1058:16
      @ tests/functional/card.ts:31:7
      at step @ build/tests/functional/card.js:33:23
      at Object.next @ build/tests/functional/card.js:14:53
      @ build/tests/functional/card.js:8:71
      at new Promise @ anonymous
      at __awaiter @ build/tests/functional/card.js:4:12
      at Test.test @ tests/functional/card.ts:25:34
      @ src/lib/Test.ts:266:51

Possible solution

😕

Steps to reproduce (for bugs)

Sample code:

<iframe id="card-frame" name="card-frame" frameborder="0" width="100%" scrolling="no" height="17" src="https://remote/iframe"></iframe>
it("should tokenize", async test =>
    test.remote
      .get("page.html")
      // Wait for inserted iframe
      .findByCssSelector("iframe#card-frame")
      .end()
      .switchToFrame("card-frame")

Environment

Intern version: 4.7.1 Node version: 13.5.0 NPM version: 6.13.4 Browser version: Chrome 79

Additional information

Using switchToFrame(0) works as expected.

maxbeatty commented 4 years ago

theintern/intern#1045