Happy birthday!
Today is October 25. Today, 12 years ago the first commit in the Selenide project was created.
For the holiday, we released a major release Selenide 7.0.0 with the update immediately to Java 17.
Condition
CollectionCondition
ElementsCollection
FileNotFoundException
by FileNotDownloadedError
*Exception
to *Error
WebDriverEventListener
$.getSelectedValue()
and $.getSelectedText()
@Report
and @GlobalTextReport
Wow!
This day came!
To use Selenide 7.+, you will need to compile & run your tests with Java 17+.
How cool is that, right?
I know some of you don’t like this decision. You are still forced to run tests on Java 8.
But we are not guilty. As you know, Selenium 4.14+ upgraded from Java 8 to Java 11. So it was not possible to stay on Java 8 anyway. You have to update to Java 11 at least.
Now, there is a very simple reasoning. In any Java project, the most complex update is from Java 8 to Java 11. Compared to this, updating from Java 11 to Java 17 is much more simple. There is nothing to do there, really.
So just update your Java!
Life is too short to continue fiddling with Java 8
See PR 2522.
This was an old potential problem in Selenide: class Condition
and any of its subclasses depended on each other.
Therefore, under certain circumstances, a deadlock could occur when these classes were loaded simultaneously. Very unlikely, but theoretically possible.
More details about static initialisation deadlock.
To fix the problem, we had to rename the base class Condition
to WebElementCondition
.
Condition.visible
imports will remain unchanged.extends Condition
by extends WebElementCondition
.See issue 2372 and PR 2453.
Here we are talking not about web elements’ checks, but “new generation” checks: url, localStorage etc.
webdriver().shouldHave(url("https://some.com/page.html"));
localStorage().shouldHave(item("mouse", "Jerry”));
sessionStorage().shouldHave(itemWithValue("mouse", "Jerry”));
clipboard().shouldHave(content("Remember me"));
Shortly, we made the error message in these checks more correct. Find details in issue 2500 and PR 2501.
Condition
Removed deprecated methods apply()
and actualValue()
in class Condition
.
This will only affect you if you wrote your own custom checks. Now, instead of two methods apply()
and actualValue()
, you will need to implement only one method check
.
See PR 2512.
CollectionCondition
Similarly to the previous change, it only affects you if you have custom checks for collections (extends CollectionCondition
). Instead of two methods test
and fail
, you need to implement only one method check
.
See PR 2520.
ElementsCollection
Be prepared for the shock.
Class ElementsCollection
does not extend java.util.List
anymore. From the very beginning, this inheritance occasionally added to ElementsCollection
many unneeded methods (like remove()
, removeRange
, clear
, subList
and listIterator()
) that we never intended to implement.
But users sometimes did use them. And even complained that these methods didn’t work.
Now we don’t have these methods and don’t have these problems.
Now $$
has only the methods we find useful. Amen.
See PR 2513.
FileNotFoundException
by FileNotDownloadedError
Before today, all methods like $.download()
were declared as throws FileNotFoundException
. And you had to suffer adding this pointless throws FileNotFoundException
to your tests. Now you can clean up this trash and remove unnecessary catch (FileNotFoundException)
if you had them.
Now methods like $.download()
will throw FileNotDownloadedError
which is inherited from AssertionError
. You don’t need to declare nor catch it. If test could not download the file - test should fail.No additional processing is needed.
See PR 2526.
*Exception
to *Error
Personally, I don’t think it matters at all.
But some users didn’t like that some of Selenide classes were named *Exception
, but didn’t extend java.lang.Exception
.
Well, we respect all opinions. Now Selenide classes inherited from java.lang.Error
are named *Error
.
See issue 2485 and PR 2530.
WebDriverEventListener
We removed all methods like addListener()
with a parameter of type org.openqa.selenium.support.events.WebDriverEventListener
.
This class has been deprecated in Selenium for a long time.
You should use addListener()
with parameter org.openqa.selenium.support.events.WebDriverListener
instead.
See PR 2516.
Yet another cleanup. Just replace
$("#what").dragAndDropTo(where);
by
$("#what").dragAndDrop(to(where));
See PR 2519.
$.getSelectedValue()
and $.getSelectedText()
One more cleanup.
$.getSelectedValue()
by $.getSelectedOptionValue()
$.getSelectedText()
by $.getSelectedOptionText()
See PR 2521.
@Report
and @GlobalTextReport
These annotations were not needed starting from Selenide 6.7.0. Just remove them. Yes, and delete TestNG, for that matter. ;)
See PR 2517.
Few more cleanups:
new BearerTokenCredentials("pwd")
by
new BearerTokenCredentials("domain", "pwd")
$.should(appears);
by
$.should(appear); // or just $.shouldBe(visible)
Selenide.open(url, BASIC, "username", "password");
by
Selenide.open(url, BASIC, new BasicAuthCredentials("username", "password"));
See PR 2518.
Towards progress!
25.10.23