We released Selenide 5.25.0.
I strongly recommend you to upgrade,
because there are even more changes coming with next releases, including the full release of Selenium 4.
If you don’t upgrade now, it will be much more difficult to clear the rubble later!
This is quite a big release with a bunch of changes, so grab some popcorn and make some tea. Let’s go!
Support for Selenium Webdriver 4.0.0 RC1
We released two builds of Selenide 5.25.0: regular and hipster one.
You can pick:
We added support for OpenTest4j
If you haven’t heard yet, OpenTest4j is a small library for assertion errors created by JUnit 5 team. The idea is that:
- all testing frameworks should throw these errors, and
- all IDEs should support them.
Yet another standard, like webdriver. :) All major players like JUnit, TestNG, AssertJ, IDEA and Eclipse already supported opentest4j, and now does Selenide too.
What will change for you personally:
When your UI fails (well, almost always), IDEA will show a nice link
<Click to see difference> below. By clicking it you can view a nice DIFF in a separate IDEA dialog.
Very convenient for debugging.
NB! If you use directly some of Selenide assertion errors (inherit or throw), you will need to update your code a bit.
We slightly change signature of their constructors:
- flipped “expected” and “actual” arguments
- removed unneeded “driver” argument from most constructors
Now we show stacktrace below every error in soft asserts
Until now, Selenide soft asserts showed only one stack trace in the end of all errors. It allows to keep the
total error message (relatively) short.
But in practice it’s convenient to see a separate stacktrace for every error. It allows to quickly click the needed line and get to the right place in the code.
Now you will see separate under every error. I personally don’t like that the error message has become much longer, but usually there shouldn’t be too many of errors, right? ;)
We added method
Until now, you could only search elements inside of shadow root, and now you can get the shadow root itself.
Though, there is still little benefit from this because search within this element is not supported (by browsers or web drivers, I am not sure).
We added method
It’s an alias for existing method
$.closest(). The name
closest was originally from JQuery (which is old!),
ancestor should be more clear because it’s a standard XPath term.
We enriched methods
Until now, this method could only search element by tag or class name:
Now it can search by attributes:
We fixed method
$.screenshot() on Mac
For a long time, Selenide has method
$.screenshot() to take screenshot of some element (instead of a full screen).
We found that this method worked incorrectly on MacBooks because of Retina display.
Now we remove the incorrect custom code from Selenide and started using a standard webdriver method that was created meanwhile. We checked it works in at least Chrome, Firefox and Edge.
Now Selenide reports an exact text at the moment of test failure
Wow, what old issues we sometimes fix! This ticket was registered already on September 6, 2015!
In general, the story is like this.
Let’s assume you have a check in test:
And a standard timeout 4 seconds. Here is one possible scenario:
- during 4 seconds, Selenide checks the element text, but it’s wrong all the time (say, “Goodbye”).
- timeout expires,
- selenide decides to throw an assertion error,
- composes an error message, including actual element text.
- at this moment the element text changes. Say, to “Hello”.
It happens very rarely, but when it happens, it may confuse a lot.
You are seeing an error message and feel totally confused:
Text didn’t match. Expected text: “Hello”, actual text: “Hello”.
Now Selenide remembers exactly the text at the moment of last check and appends it to the error message.
P.S. In next releases, we are going to improve this mechanism even more. We will show the history of element texts during those unfortunate 4 seconds. It may help debugging some tricky cases with flaky tests etc.
We now forbid an empty argument in method
There is a method for checking element text with a regular expression:
We found that it was possible to occasionally pass an empty string to
matchText which might cause false-positive tests.
Now you will see an exception when trying to execute
java.lang.IllegalArgumentException: Argument must not be null or empty string
See PR 1566
We added check
As usually, you can use it with default or custom timeout:
webdriver().shouldHave(title("Login page")); webdriver().shouldHave(title("Login page"), ofMillis(10));
with upgrade to Selenide 5.25.0.
with upgrade to Selenide 5.25.0.
Selenide downloads statistics
The milestone has been passed: we exceeded 250 thousand downloads per month.
By the way, we have come close to another significant milestone: in October, Selenide will be … 10 years old!
It’s hard to believe, but the first commit was made in the repository on October 25, 2011. Just look how ridiculous it was! :)