I’m bad at writing articles for this site. I have dozens of posts from the past several years that are in various stages of progress, none of which are quite “good enough” to publish. Someone recently gave me a great suggestion that I just write what I’ve been up to professionally for the month and not worry about creating the code examples and getting everything perfect. So, I’m giving it a try…
This month is slightly unusual because I became the father of a tiny human at the end of October, so I’ve been on paternity leave and therefore not working on anything Sauce Labs specific.
Selenium 4.1 Work
We released Selenium 4.1 on November 22. It was a relatively minor release. The main thing for all languages was to ensure shadow DOM support worked as expected in all the languages now that Chrome and Edge v96 support it. Also of interest, now that we are including code that works with the Chrome DevTools Protocol, we have to manage support for specific versions of Chrome in the Selenium codebase. Ruby is the only language that completely decoupled this by maintaining a selenium-devtools gem that will automatically work with whatever version of Selenium is being used. Java releases a separate package, but the release process is mostly tied to the main Selenium release process, and the other languages are more integrated into the Selenium code itself. For the foreseeable future, I would expect a minor Selenium release every time a new Chrome version comes out.
Selenium 4.2 Work
Someone recently reported a missing feature in Firefox Addons. Essentially, testing on a release version of Firefox,
an ‘unsigned’ extension needs to be flagged as temporary in order for it to be installed.
Java and .NET were not allowing this to be toggled. I fixed this, but in the process, I noticed that .NET
addon parameter instead of
file parameter, and I got very excited when I
looked up its purpose.
Let’s back up a second. Unlike Chrome, where you can install extensions as part of capabilities when you create a session,
Firefox makes you first start a session, then use the
installExtension() on the Firefox driver. For Selenium 4.0,
I made sure that the
RemoteWebDriver also had access to this method in Ruby & Java. Unfortunately, these methods
take a String argument representing the path on the local system, which obviously doesn’t work if the driver is on
a remote machine. To address this, I implemented the aforementioned Ruby and Java code with the
using a Local File Detector— similar to how Selenium supports uploading files in a form.
The Ruby implementation wasn’t so bad, but in Java the upload code is essentially duplicated and
I needed Simon’s help to figure out how to properly wrap the driver.
The exciting thing is that this
addon parameter accepts a base64 encoded value, so we can skip the file upload issue
so I fixed the ugly Java implementation and updated the Ruby and Python.
The major thing that is going to be added in Selenium 4.2 is scroll wheel support, which is going to provide users with native scrolling behavior for the first time. The behaviors specified by the W3C are not straightforward, and I’ve been throwing around a number of ideas for how to make things more obvious in the user-facing API. For things like this, I’m hoping we can get something similar implemented by all the bindings instead of each maintainer doing their own thing. I’ll try to write an article about all of this when it’s finished.
Our current Selenium Documentation is not up to date with the latest Selenium implementations and needs more code examples. I started to fix up the “getting started” documentation, but I quickly realized just how disorganized the structure of our documentation is. I worked up a proposal for a major reorganization. The problem is that we currently manage 9 languages (English and 8 translations). Each time a file gets moved or is renamed, the title needs to be updated and aliases need to be created for redirecting from the old page. Doing this 9 times for every change is a lot of work. Diego and I gathered some information and I submitted a proposal to add translators as an official part of the Selenium project. The plan is to advertise that we’re looking for people to join the Selenium team as an official translator for a specific language, then archive the translations that do not have an assigned translator.
Watir 7.1 Work
I released Watir 7.1 on November 15.
Per the W3C WebDriver Specification, the
pointerMove action should not scroll the page, and if the location of the
pointer target is outside of the viewport, the driver is supposed to return a “move target out of bounds” error. Watir
has addressed this by automatically scrolling the element into view using the
WatirScroll class before executing
the action. A user asked for more control over this scrolling. In the process of addressing this, I wrote a bunch
of new tests to ensure the behavior was as intended, then fixed up a number of things that weren’t entirely correct.
I started to write an article about this, but the scroll wheel work I’m doing for Selenium 4.2 is probably going to change
what I’d otherwise write, so I’ll wait for that and see where we end up.
Watir 7.2 Work
With shadow DOM support added to Selenium, I’ve created basic support for it in Watir.
I haven’t merged it yet because I’m not super happy with it. I don’t love how I’ve had to
move a bunch of
Element methods into a separate module to so the
ShadowRoot object can have partial
behavior. Really the crux of the issue is that
is well past the need for refactoring and needs to be replaced with an Executor class.
Also, Watir locators are implemented entirely with XPath at this point, and since Google has not
deigned to provide XPath support within a shadow root for Chromium, the solution in Watir is not very performant.
Unfortunately I’m not looking to dedicate a lot of time to Watir coming up,
so I’m probably going to just merge this and fix things as people request it.
Looking Forward to December
Selenium Code: Ensure scroll wheel support is added to all bindings. Watir: Merge in the limited shadow DOM support. Selenium docs: Once the translations have been sorted out, I’m expecting to spend a lot of the month working on these.
Here are some of the half-written articles I’ve been sitting on. I make no promises, but if any of these sound especially interesting, please let me know, and maybe it’ll motivate me to finish them up:
- Supercharge Your Remote Tests with the Java Augmenter
- What the Test Pyramid Gets Wrong
- Parallel Execution in Selenium 4 with JUnit 5
- Accessibility in Selenium with Sa11y library
- Attributes are not Properties
or answer one of these questions in the comments or on Twitter: