Hello!
Before the summer begins, it’s a good moment to upgrade to Selenide 7.9.3.
- Updated Selenium from 4.32.0 to 4.33.0
- Click holding left keys
- Bug with focus in
$.setValue
- Fixed lazy initialisation of page objects
- Check “texts in any order” in
FULL_TEXT
mode
Updated Selenium from 4.32.0 to 4.33.0
And bumped CDP version from v136 to v137. It’s crazy how cool this is!
See PR 3034
Click holding left keys
Recently we implemented JS click while holding keys ALT
, CTRL
, SHIFT
or META
.
But we forgot about keys LEFT_ALT
, LEFT_CONTROL
, LEFT_SHIFT
. It’s crazy how we missed them?
Now JS click will work with left keys as well:
$("#btn").click(using(JS)
.holdingKeys(LEFT_CONTROL, LEFT_SHIFT, LEFT_ALT));
See issue 2763 and PR 3030.
Fixed bug with focus in $.setValue
As you know, method $.setValue()
can work either using sendKeys
, or using JavaScript.
The last method can speed uo your tests and improve stability.
But there was one trick with focus. :)
Focus
When you call method $.setValue(JS)
on some element like <input>
then Selenide performs the following steps:
- Remove focus from the previous active element;
- Set focus to our desired element
<input>
- Enter the value
Problem
If our desired element was already focused then steps #1 and #2 removed and re-set the focus for the same element.
And everything would be fine, but there are elements that … disappear when they lose the focus.
And they disappeared after the first step.
And the second step failed because <input>
was not found anymore.
It’s crazy how this can even be debugged?
Solution
Now method $.setValue(JS)
will be a little smarter and will not play with the focus if the desired element is already focused.
See PR 3035.
Fixed lazy initialisation of page objects
You may not know, but page objects in Selenide are lazy. You can create an instance of page object BEFORE any browsers are opened. No web elements will be searched anywhere (until you try to use them).
A problem has been discovered: if a page object has a field of the type List<WebElement>
(and the browser is not open yet),
then it crashes with an error like “browser is not opened yet”. It’s crazy how no one has complained about this yet?
Now page objects with fields of type List<WebElement>
will also be lazy-initialized.
We recommend to use type
ElementsCollection
instead ofList<WebElement>
.
See PR 3036.
Fixed check “texts in any order” in FULL_TEXT
mode
Selenide has a setting FULL_TEXT
which you all should turn on. :)
But it turned out a couple of checks didn’t take this setting into account…
In Selenide 7.9.1 we fixed method
texts
, but forgot about textsInAnyOrder
.
Now textsInAnyOrder
will also work correctly with enabled setting FULL_TEXT
:
Configuration.textCheck = FULL_TEXT;
$$(".element").shouldHave(texts("sham", "", "delegation"));
$$(".element").shouldHave(textsInAnyOrder("delegation", "", "sham"));
See PR 3037.
NB! We recommend to set it in all your projects:
Configuration.textCheck = FULL_TEXT
;In Selenide 8.0.0 it will be enabled by default.
What many developers don’t realize is that if it weren’t for tests, lots of really bad things would have already happened to their projects, and I mean REALLY BAD.
Don’t play with fire, write tests.
selenide.org
27.05.25