Released Selenide 7.0.1

Released Selenide 7.0.1

Dude, where's my loop?
26.10.23

Yesterday we released Selenide 7.0.0. I expected complains about Java 17, but…

no. Nobody complained about Java 17. And that’s great!
But people asked to restore loops over collections.

Well, in today update Selenide 7.0.1 we restored a couple of things:


Restore loops over collections

Now you can use for loop again:

for (SelenideElement element : $$(".element")) {
  element.shouldBe(visible);
}

And I won’t tire of repeating that

DON’T DO IT!

Don’t use loops and ifs in tests!

If you want to collect the texts/attributes of all elements to check them - Selenide has “collection conditions” for that:

  $$(".errors").shouldHave(texts("One", "Two", "Three"));

  $$("#numbers option").shouldHave(attributes("value",
                   "one", "two", "three", "four", "five"));

If you haven’t found a suitable check for your needs, you can easily create your own custom condition. Just create a class inheriting WebElementsCondition and implement method check. That’s easy.
And you can reuse it in all your tests.

See PR 2533.


Restore method isEmpty() for collections

I still understand why, but people do you this method:

  boolean errorsFound = $$(".error").isEmpty();

See PR 2533.


Return field self in containers

In release 7.0.0, we removed class ElementsContainer. With this, you lost method getSelf(). I still find it strange, but people do you this method as well.

If this sounds like you, then you can replace the getSelf() method with a field annotated by @Self:

static class RadioButton implements Container {
  @Self
  SelenideElement label;

  @FindBy(tagName = "input[type=radio]")
  SelenideElement input;
}

See PR 2534.


Renamed CollectionCondition to WebElementsCondition

It affects you only if you have custom collection conditions.

Not a problem. Just replace extends CollectionCondition by WebElementsCondition.

See issue 2372 and PR 2533.


UPD 7.0.2: Upgraded to Selenium 4.15.0

We released Selenide 7.0.2 with upgrade to the latest Selenium 4.15.0.

Here is Selenium changelog.

See PR 2540.


Andrei Solntsev

selenide.org

26.10.23