Chromedriver fixes behaviour, breaks test
Our selenium
CI tests started failing after a new version of Google’s Chromedriver came out. As can be seen in the release notes, v91 fixes an issue with the attribute endpoint. ChromeDriver (and other web drivers conforming to the W3C web driver spec) have a client-server architecture where commands are sent to specific endpoints. A command to get an element attribute is executed by a client (for example the Python Selenium module) making a request to a url like http://<web-driver-hostname:port>/session/<session-id>/element/<element-id>/attribute/<attribute-name>'
.
The tests started failing because in our code, we mistakenly use the get_attribute()
method in a couple places where we actually are querying for a DOM element property
, not an attribute
(namely innerText
). The difference between a DOM property and an HTML attribute is well explained here. Before v91, this method worked even though it was wrong. The solution is to obviously switch the calls from Selenium’s get_attribute()
to get_property()
. Other people were bitten by this issue as well.