Closed Bug 1588424 Opened 5 years ago Closed 4 years ago

WebDriver:SwitchToWindow has to make use of `handle` argument if present in payload

Categories

(Remote Protocol :: Marionette, enhancement, P1)

Version 3
enhancement

Tracking

(firefox80 fixed)

RESOLVED FIXED
mozilla80
Tracking Status
firefox80 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

Details

User Story

https://firefox-source-docs.mozilla.org/testing/marionette/NewContributors.html

Attachments

(1 file)

To get the usage of the name argument removed without breaking backward compatibility between Firefox and geckodriver, we want to add the usage of the handle parameter for now. Once that has been stabilized well enough throughout a couple of Firefox and geckodriver releases, we could finally fix bug 1301073.

The code which needs an update can be found at:

https://searchfox.org/mozilla-central/rev/5e830ac8f56fe191cb58a264e01cdbf6b6e847bd/testing/marionette/driver.js#1542-1577

Here cmd.parameters.handle needs to be checked for, and if present it needs to be handled with a higher priority than cmd.parameters.name. It's value type is also String, and will need a check/conversion to Number for.

To verify the behavior is correct the following tests would have to be run:

https://searchfox.org/mozilla-central/source/testing/marionette/harness/marionette_harness/tests/unit/test_switch_window_content.py
https://searchfox.org/mozilla-central/source/testing/marionette/harness/marionette_harness/tests/unit/test_switch_window_chrome.py

Summary: WebDriver:SwitchToWindow has to make use of `handle` argument if present → WebDriver:SwitchToWindow has to make use of `handle` argument if present in payload

With bug 1519053 we got the handle argument added to geckodriver. That means it would be good to actually swap these parameters now, and fully get rid of name in Marionette and geckodriver.

Depends on: 1519053
Priority: -- → P3
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Priority: P3 → P1
Mentor: hskupin
Whiteboard: [lang=js]
Pushed by hskupin@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/2e1cb270c746 [marionette] Remove "name" parameter from "WebDriver:SwitchToWindow" command. r=marionette-reviewers,webdriver-reviewers,maja_zf
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80

It seems this change https://phabricator.services.mozilla.com/D83625 broke the compatibility between geckodriver 0.24.0 and firefox 80.0b1.

When I run Selenium Java test https://github.com/SeleniumHQ/selenium/blob/trunk/java/client/test/org/openqa/selenium/WindowSwitchingTest.java with geckodriver 0.24.0.

From geckodriver debug log, when switch to a window, I got log messages like this:

1596131351691 webdriver::server DEBUG -> GET /session/40bd9dfe-b75e-4643-ba4d-162b78f6aad0/window/handles
1596131351708 webdriver::server DEBUG <- 200 OK {"value":["45","10737418255","31"]}
1596131351717 webdriver::server DEBUG -> POST /session/40bd9dfe-b75e-4643-ba4d-162b78f6aad0/window {
"handle": "10737418255"
}
1596131351733 webdriver::server DEBUG <- 400 Bad Request {"value":{"error":"invalid argument","message":"Expected "handle" to be a string, got [object Undefined] undefined","stacktrace":"WebDriverError@chrome://marionette/content/error.js:175:5\nInvalidArgumentError@chrome://marionette/content/error.js:304:5\nassert.that/<@chrome://marionette/content/assert.js:479:13\nassert.string@chrome://marionette/content/assert.js:383:53\nGeckoDriver.prototype.switchToWindow@chrome://marionette/content/driver.js:1645:10\ndespatch@chrome://marionette/content/server.js:305:40\nexecute@chrome://marionette/content/server.js:275:16\nonPacket/<@chrome://marionette/content/server.js:248:20\nonPacket@chrome://marionette/content/server.js:249:9\n_onJSONObjectReady/<@chrome://marionette/content/transport.js:501:20\n"}}

It seems a logical error to me since the "handle" value in the request is actually the string, but the marionette driver.js complained it's not.

Could anyone please let me know if this incompatibility is expected for old geckodriver 0.24.0?

OK, according to https://firefox-source-docs.mozilla.org/testing/geckodriver/Support.html#clients, geckodriver 0.24.0 only works up to firefox 79. So it's expected that it won't work with firefox 80.

Right, and I would suggest that you really update your geckodriver to the freshly released 0.27 to get all the bug and security fixes.

Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: