We released Selenide 5.13.0.
Be prepared: it might break your tests (it they were not accurate).
$.shouldHave(text("")) now throws an exception
Probably most popular Selenide method is
$.shouldHave(text("something")). But if you even use it daily, you might not
realize that it checks a substring, not the whole text.
So, a check
$("h1").shouldHave(text("ello")) works even for element
A special case of this check is empty text:
$("h1").shouldHave(text("")). This check is useless becase
any string contains an empty substring.
If you need to check that text is empty, you can use either
We want to help you overcome this typical problem and avoid useless checks. Now Selenide will throw an exception if
you pass null or empty string to method
I tried Selenide 5.13.0 on my current project and found 20-30 tests that failed because of this new exception.
All of this were logical errors in tests. You see what a useful change waits for you. :)
See issue 1156.
Thanks to Roman S.A. for PR 1186.
Removed duplicated allure logs
You might see that Selenide may logs the same action twice in some cases. For example, when executing this:
(actually this problem is not only in Allure reports, but also in usual Selenide
Now we removed those duplicated logs. We had to refactor some code and change some other error messages, so be prepared.
Improved error messages for collections
Another story where we have changed error message format in case of search failure inside a collection. I hope it should be clearer now what exactly Selenide failed to find.
Fixed uploading of files without
As you probably know, Selenide allows uploading multiple files with one command:
$("input").uploadFile( new File("a.txt"), new File("b.txt"), new File("c.txt") );
To enable it, we once did a JS trick in Selenide.
Now it appeared that this hack required
<input> to be inside of
<form>. This is reasonable, but for some reason
there are inputs that exist outside of
$.uploadFile() didn’t work for them.
Now we simplified upload implementation. Now it works for any inputs and doesn’t use JS tricks.
Fixed downloading files with quotation marks in the name
… and other “bad” symbols.
It sounds strange, but sometimes people want to download files that have bad symbols in name (quotation marks, apostrophes etc).
Linux and Mac can save such files, but Windows cannot. Selenide method
$.download() failed on Windows for such files.
$.download() replaces quotation marks and other “bad” symbols in file name by underscore, as all major browsers do.
See issue 1196 and PR 1199.
Configured webdriver to write its logs to a file
Until now, webdrivers started by Selenide didn’t write their logs to anywhere. You had to enable it explicitly if you needed them.
Now Selenide enables webdriver logs by default. They are written to file like
You can get full file name from Selenide logs like this:
INFO Write webdriver logs to: /andrei/build/reports/tests/webdriver.1594248139109_18125_1.log
Read these logs next time when you need to debug some weird webdriver behaviour.
See issue 1206 and PR 1207.
Added new way of downloading files:
As you probably know, Selenide has 2 options for downloading files:
See post in our blog.
HTTPGET- simple and stable. But it can only download files using links like
PROXY- generic and powerful. But it may cause problems if you run browser remotely because it requires access from “browser machine” to “tests machine”. It often causes troubles for Selenoid and Grid users.
Now we have a third optionL:
To use it, just add this line in the beginning of tests:
Configuration.fileDownload = FileDownloadMode.FOLDER;
It’s working mechanism is very simple:
- It clicks the element,
- Watches for new files in folder
- If there are several new files, tries to guess which one if them suites better.
As always, you can find a working example in Selenide own tests.
P.S. We consider this option experimental by now because there are some nuances:
- It works well on local run with single browser, but
- During parallel run, multiple browsers might download their files into the same folder, and then Selenide might pick a wrong file.
- During remote run, this option doesn’t work at all. Tests are on machine A, but browser and files are on machine B.
- Currently only Chrome, Firefox, Edge, Opera are supported. But IE and Safari are not: they don’t allow to configure the downloads folder.
We will work on those nuances. Please share your thoughts on how can we solve them.
See issue 1212, PR 1213 and PR 1215.
UPD Later we improved method
FOLDER, and now you can safely use it in your projects.
$.getWrappedElement() waits for the element. Again.
Probably it doesn’t affect you, but I have to mention it. Essentially, we reverted one recent change (made in Selenide 5.11).
Assuming you have the following code:
button is shown with a delay.
Selenide always waits for this
button to appear, and only then executed the JS code.
In Selenide 5.11 we did a change, so that Selenide didn’t wait for the
It could break some tests which occasionally relied on that behaviour.
Now we restored that old behaviour: Selenide waits for the
button again before executing JS code.
See issue 1191 and PR 1203.
Upgraded to BrowserUpProxy 2.1.1
Just in case
Upgrade. Try. Share you feedback.
And here is my favorite part: latest Selenide downloads statistics.
We hit the line 160 thousands per months!
and 31+ thousands of unique IPs:
Life is good!