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 119 release cycle.
Contributions
With Firefox being an open source project, we are grateful to get contributions from people outside of Mozilla:
- Nagendra refactored certain helper methods in our tab manager module to make use of the new
getTabsForWindow
method.
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 and geckodriver.
General
Bug fixes
In Firefox 119, several bugs were simultaneously fixed for WebDriver BiDi and Marionette:
- When performing a “pointerDown” action with the middle or right mouse button pressed, the “mousedown” event as emitted by the related HTML element had the value of the “buttons” property swapped.
- When performing a “scroll” action of input type “wheel” with an origin set to “pointer” an “invalid argument” error was inappropriately raised, whereas per the current WebDriver specification this combination is not supported.
WebDriver BiDi
New: “browsingContext.reload” command
With the browsingContext.reload
command, it is now possible to reload the page that is currently displayed within a given browsing context. Note that there is no limitation anymore (as in WebDriver classic) to a top-level browsing context, so even individual frames can now be reloaded. A limitation at the moment is that Firefox will reload the page only from the cache. The support for the ignoreCache
argument we be added at a later time.
New: “browsingContext.userPromptClosed” event
Back in Firefox 118 we added the browsingContext.userPromptOpened
event, which is emitted whenever a user prompt of type “alert”, “confirm” or “prompt” is opened. With the Firefox 119 release, the browsingContext.userPromptClosed
event is now available as well, and is emitted when such a user prompt is closed. The event’s payload contains the context
where the dialog is displayed, the accept or dismiss state, and as well the user-entered text in case of a user prompt of type “prompt”.
This event will also support "beforeunload"
type dialogs in the future, but they are not handled at the moment.
New: “browsingContext.navigationStarted” event
The <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1756595">browsingContext.navigationStarted</a>
is a new event, which gets emitted when a new navigation is started by Firefox. A navigation can be requested by using the browsingContext.navigate
or the new browsingContext.reload
command, by some user interaction with elements within a page, or some JavaScript executed in the page’s context that causes a navigation to a different page. The event’s payload contains the context
where the navigation takes place, a unique navigation id
, the URL
that Firefox navigates to, and the timestamp.
New: “script.realmCreated” and “script.realmDestroyed” events
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1788657">script.realmCreated</a>
and <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1788659">script.realmDestroyed</a>
are new events that allow WebDriver BiDi clients to monitor the lifetime of JavaScript Realms of a given browsing context. Such a Realm is basically an isolated execution environment with its own unique global object (window). By default, only a single Realm will exist per page, but when using script.evaluate
or script.callFunction
with the sandbox
argument, a new Realm can be created. To get all the existing Realms for a page, you can still use the script.getRealms
command. The payload for the script.realmCreated
event will contain the realm information of the created Realm, which includes Realm’s identifier, the browsing context, the Realm’s type and if relevant the name of the Sandbox. The payload for script.realmDestroyed
only contains the Realm’s identifier.
Bug fixes
- The
browsingContext.userPromptOpened
event was accidentally sent when a HTTP Authentication dialog was opened. - Some events like
browsingContext.domContentLoaded
that are related to browser activities around the time when a browsing context gets closed could have been sent out inappropriately with a browsing context set to “null
“. We’ve fixed that so these unwanted events are no longer emitted.
Marionette (WebDriver classic)
Bug fixes
- The list of possible error codes when trying to install a WebExtension by using the
Addon:Install
command has been updated to match the latest error codes of Firefox.
Leave a Reply