WebDriver is a remote control interface that enables introspection and control of user agents. As such it can help developers to verify that their websites are working and performing well with all major browsers. The protocol is standardized by the W3C and consists of two separate specifications: WebDriver classic (HTTP) and the new WebDriver BiDi (Bi-Directional).
This newsletter gives an overview of the work we’ve done as part of the Firefox 135 release cycle.
Contributions
Firefox is an open source project, and we are always happy to receive external code contributions to our WebDriver implementation. We want to give special thanks to everyone who filed issues, bugs and submitted patches.
In Firefox 135, several contributors managed to land fixes and improvements in our codebase:
- Liam (ldebeasi) added a new argument to
browsingContext.captureScreensho
t. - Patrick (pshannon) added internal logs to help us investigate incomplete network events.
- Spencer (spenneth) created a helper to check if a browsing context is a top level one and reduced duplication in our logic to list opened windows.
WebDriver code is written in JavaScript, Python, and Rust so any web developer can contribute! Read how to setup the work environment and check the list of mentored issues for Marionette, or the list of mentored JavaScript bugs for WebDriver BiDi. Join our chatroom if you need any help to get started!
General
Improved user interactions simulation
To make user events more realistic and better simulate real user interactions in the browser, we have moved the action sequence processing of the Perform Actions
commands in both Marionette and WebDriver BiDi from the content process to the parent process. While events are still sent synchronously from the content process, they are now triggered asynchronously via IPC calls originating from the parent process.
Due to this significant change, you might experience some regressions. If you encounter any issues, please file a bug for the Remote Agent. If the regressions block test execution, you can temporarily revert to the previous behavior by setting the Firefox preference remote.events.async.enabled
to false
.
With the processing of actions now handled in the parent process the following issues were fixed as well:
- We now support proper queuing of action sequences without race conditions. This is particularly important for WebDriver BiDi’s
input.performActions
command, which can be called multiple times in parallel and must execute the enqueued actions sequentially. - When dispatching actions, the
input cancel list
is now correctly updated only after the action has been successfully dispatched. Previously, if an action failed to execute, a reverse action could be left in place, leading to unexpected side effects when resetting the state of theinput source
. - When performing actions, individual actions are now retried during dispatch, particularly in situations where a single action triggers a navigation that replaces the current browsing context.
- When performing actions, a
TypeError
error no longer occurs if an action (not the last one) in the action chain closed the window, and the remaining actions were still being dispatched.
WebDriver BiDi
New: format
argument for browsingContext.captureScreenshot
Thanks to Liam’s work, the browsingContext.captureScreenshot
command now supports the format
argument. It allows clients to specify different file formats ("image/png"
and "image/jpeg"
are currently supported) and define the compression quality for screenshots.
The argument should follow the browsingContext.ImageFormat
type, with a "type"
property which is expected to be a string
, and an optional "quality"
property which can be a float
between 0 and 1.
-> {
"method": "browsingContext.captureScreenshot",
"params": {
"context": "6b1cd006-96f0-4f24-9c40-a96a0cf71e22",
"origin": "document",
"format": {
"type": "image/jpeg",
"quality": 0.1
}
},
"id": 3
}
<- {
"type": "success",
"id": 3,
"result": {
"data": "iVBORw0KGgoAAAANSUhEUgAA[...]8AbxR064eNvgIAAAAASUVORK5CYII="
}
}
Bug Fixes
- Fixed a bug where some Marionette and WebDriver BiDi commands that rely internally on a
requestAnimationFrame
being emitted before returning would hang if the current browsing context was navigated during their execution.
Leave a Reply