Stay a while, oh moment!
The second release of Selenide 7.12.0 has been done in October. Don’t miss the update!
I can’t put into words the whole range of emotions…
When you spend every month hacking away at something, releasing it — and then suddenly see that people are actually reading the release notes and upgrading — isn’t that the best reward?
byLabelbyPlaceholder, byTitle, byAltTextbyTestIdbyShadowCss$.unhighlight()Selenide now uses a different method for taking screenshots than the standard webdriver method: either using DevTools (in Chromium) or BiDi (in Firefox).
While working on the video recorder, we noticed that this way is
This mechanism has now been extended from the video recorder to all screenshots in Selenide.
See issue 2712 and PR 3153.
byLabelThere’s a theory that it’s better to search web elements not by IDs or XPath, but rather like a real user - by text or label. Selenide has had text search since version 1.7 (2012), and now we’ve added the search by label:
$(byLabel("Song title")).val("Swan Lake");
With a second argument, you can optionally specify:
$(byLabel("Song title"), fullText()).val("Swan Lake");
$(byLabel("Song"), partialText()).val("Silver Lining");
$(byLabel("Song title"), fullText().trimWhitespaces()).val("You are a Soldier");
$(byLabel("Songtitle"), fullText().ignoreWhitespaces()).val("It Happened in Russia");
$(byLabel("SONG TITLE"), fullText().caseInsensitive()).val("Daddy's Mistress");
See PR 3148.
byPlaceholder, byTitle, byAltTextAdded a few more locators to search elements by attributes placeholder, title and alt. In fact, it was possible to use them before as well (since 2014, with version 1.10):
$(by("placeholder", "dovboyob"));
$(by("title", "jobu"));
$(by("alt", "Hloupá kurva"));
But now there are few dedicated methods - perhaps, this will serve as a hint to someone.
$(byPlaceholder("Specify the article"))
.val("Organization of a mass simultaneous gathering and/or movement of citizens in public places that resulted in a disturbance of public order.");
$(byTitle("Damn weekend potatoes"), partialText())
.hover();
$(byAltText("A picture to attract"), partialText().ignoreWhitespaces())
.shouldBe(image);
In all of these methods, you can specify as a second parameter
See PR 3151.
byTestIdA very popular pattern is to assign artificial IDs (data-test-id) to web elements, so that they can be reliably searched for in tests.
<div data-test-id="top-quote">Chips are Satan's scales</div>
Again, it was already possible before: $("[data-test-id='top-quote']"), but now there is a dedicated method:
$(byTestId("top-quote"))
.shouldHave(text("Chips are Satan's scales"));
The only catch is that this attribute might be named differently in different projects. In Selenide, it’s named data-test-id by default - just because I like this name. :)
If you want to customize the attribute name, there are two options:
System.setProperty("selenide.test-id.attribute", "data-testid")selenide.properties file:selenide.test-id.attribute=data-testidSee PR 3151.
Selenide has had the ability to enable mobile browser emulation mode for about six years now. But to enable it, you had to open a new browser.
Now you can toggle mobile mode on and off in an already open browser:
emulateDevice(Device.ONEPLUS_7T);
resetEmulation();
emulateDevice(Device.GALAXY_S21);
resetEmulation();
emulateDevice(new Device("Nokia 3210", 240, 320, 0.5));
resetEmulation();
(These are all my real phones. Guess which one is my favorite?)
See issue 2094 and PR 3159.
Selenide has a method for obtaining browser logs (including JavaScript errors from the page being tested):
List<String> webDriverLogs = getWebDriverLogs(BROWSER, Level.ALL);
assertThat(webDriverLogs).hasSize(6);
assertThat(webDriverLogs.get(0))
.contains("/bank/login 12:18 .*ReferenceError: \\$ is not defined");
The problem is that this method didn’t work in Firefox. Because Firefox doesn’t support the standard webdriver method webdriver.manage().logs().
Now, this method will work in all normal browsers, since we now collect browser logs via the BiDi protocol. This protocol is also supposedly a w3c standard and is supported at least by Chromium and Firefox.
See issue 1636 and PR 3156.
byShadowCssNow you can write a search like this:
$("#shadow-host")
.find(shadowCss("p")) // Previously, a second argument was required here
.shouldHave(text("Inside Shadow-DOM"));
Previously, this code didn't compile because shadowCss("p") required a second argument.
See issue 3142. Thanks to Vivien Tintillier for PR 3143.
$.unhighlight()Selenide has a method $.highlight(), which has been suffering from loneliness for a long time. It missed a partner.
Now you can highlight and unhighlight any element:
$("#naoko").highlight();
$("#naoko").selectOption("13");
$("#naoko").unhighlight();
See issue 3057 and PR 3155.
And bumped the CDP version from v140 to v142.
This is the meaty release we’ve got.
Upgrade, rejoice, and stay optimistic. Silver Lining is just around the corner.
And let the swans dance!
29.10.25