Closed Bug 1588424 Opened 5 years ago Closed 4 years ago

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


(Remote Protocol :: Marionette, enhancement, P1)

Version 3


(firefox80 fixed)

Tracking Status
firefox80 --- fixed


(Reporter: whimboo, Assigned: whimboo)



User Story


(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:

Here cmd.parameters.handle needs to be checked for, and if present it needs to be handled with a higher priority than 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:

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
Priority: P3 → P1
Mentor: hskupin
Whiteboard: [lang=js]
Pushed by
[marionette] Remove "name" parameter from "WebDriver:SwitchToWindow" command. r=marionette-reviewers,webdriver-reviewers,maja_zf
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla80

It seems this change broke the compatibility between geckodriver 0.24.0 and firefox 80.0b1.

When I run Selenium Java test 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, 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.