Good quarantine!
It was the third day of quarantine.
To make you feel not so lonely, we released Selenide 5.10.0 with a bunch of improvements. Some of them are even slightly backward incompatible. Well, so you do not get bored in your dens.
- Added support for Shadow DOM
- Don’t fetch BrowserUpProxy by default
- Replace Guava APIs by Java APIs
- Made Selenide Allure report nicer
- Added condition shouldBe(image)
- Videos
We added support for Shadow DOM
See examples in tests:
$(shadowCss("#anyButton", "#shadow-host")).click();
$(shadowCss("p", "#shadow-host")).shouldHave(text("Inside Shadow-DOM"));
$(shadowCss("p", "#shadow-host", "#inner-shadow-host")).shouldHave(text("The Shadow-DOM inside another shadow tree"));
Firefox: Calling setValue("text")
/ val("text")
on an input field will result in an error, saying that the element is “not reachable by keyboard”.
Temporary workaround for now is to use fastSetValue=true
:
Configuration.fastSetValue = true;
$(shadowCss("input", "#shadow-host")).setValue("test");
See issue 1014.
Thanks to Dmytro Stekanov for PR 1090.
Selenide does not fetch BrowserUpProxy by default
Taking those two facts into account:
- Selenide fetches BrowserUpProxy and all its transitive dependencies - it’s about ~17MB in total.
- Most of Selenide users (I guess) do not use Selenide proxy.
we decided to avoid fetching those 17 megabytes by default.
The dependency
Those of you who wants to use proxy just need to add a dependency to your project:
testRuntime 'com.browserup:browserup-proxy-core:2.0.1'
(many of you already have it anyway).
Don’t worry if you forget to add the dependency - you will see a clear error message like this:
java.lang.IllegalStateException: Cannot initialize proxy. Probably you should add BrowserUpProxy dependency to your project.
at com.codeborne.selenide.drivercommands.CreateDriverCommand.createDriver(CreateDriverCommand.java:44)
...
at com.codeborne.selenide.Selenide.open(Selenide.java:41)
caused by: java.lang.NoClassDefFoundError: com/browserup/bup/BrowserUpProxy
See issue 1021 and PR 1094.
UPD 12.03.2023
Nowadays we don’t need to add that dependency anymore. Just use com.codeborne:selenide-proxy
instead of com.codeborne:selenide
.
It will add all needed dependencies automatically.
Just in case
Probably you feel curious who eats those 17 megabytes? Here they are.
This is the list of files that should disappear from your project. The list is impressive, right?
- animal-sniffer-annotations-1.17.jar
- barchart-udt-bundle-2.3.0.jar
- bcpkix-jdk15on-1.62.jar
- bcprov-jdk15on-1.62.jar
- browserup-proxy-core-2.0.1.jar
- browserup-proxy-mitm-2.0.1.jar
- checker-qual-2.5.2.jar
- dec-0.1.2.jar
- dnsjava-2.1.9.jar
- error_prone_annotations-2.2.0.jar
- failureaccess-1.0.1.jar
- guava-27.1-jre.jar
- jackson-annotations-2.9.9.jar
- jackson-core-2.9.9.jar
- jackson-databind-2.9.9.1.jar
- javassist-3.25.0-GA.jar
- javax.activation-api-1.2.0.jar
- jaxb-api-2.3.1.jar
- jcl-over-slf4j-1.7.28.jar
- jsr305-3.0.2.jar
- jzlib-1.1.3.jar
- listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar
- littleproxy-2.0.0-beta-5.jar
- netty-all-4.1.39.Final.jar
Migrated Guava API to corresponding Java API
We just changed
com.google.common.base.Predicate
from Guava- to
java.util.function.Predicate
from Java 8
and removed Guava dependency. It was great (until Java 8 was released), rip.
If you occasionally implemented your own CollectionCondition
, you will need to rename apply
to test
. It must be easy.
See issue 1091.
Thanks to Wladimir Schmidt for PR 1091.
We made Selenide Allure report a little nicer
We actually just added quotes around selectors in the Allure report.
Now you can copy selectors from the report and paste into browser’s developer console (though, I cannot imagine why somebody should do it).
See issue 1032.
Thanks to Dmytro Stekanov for PR 1092.
We added condition $("img").shouldBe(image)
You can use it to check that image was successfully loaded.
See examples in tests:
$("#valid-image img").shouldBe(image);
$("#valid-image").shouldNotBe(image);
$("h1").shouldNotBe(image);
See issue 1069.
Thanks to Dmytro Stekanov for PR 1086.
We fixed find element by attribute which contains quites
For some reason, people sometimes put quotes inside attributes.
When trying to find an element by such an attribute, Selenide generated an invalid CSS locator.
Now we fixed it.
See issue 1060.
Thanks to Denys Lystopadskyy for PR 1062.
Videos
Did you think that probably SeleniumCamp 2020 is The Last Conference on Earth?
Because of quarantine, they have published all SeleniumCamp 2020 videos.
Among others, this playlist contains my 3 videos (sorry, they are in Russian):
- Flaky tests: The method
- BOF: Glorious past and promising future of Selenide
- Threesome: Selenide for Web, Android and iOS
selenide.org
18.03.20