Released Selenide 5.22.0

Released Selenide 5.22.0

Wake up, we have a release again!
08.06.21

Good morning!

For my birthday, we made an anniversary release Selenide 5.22.0.

Let’s unbox the gift!


Now you can close an alert to download a file

Selenide has method $.download() which works by a very simple principle:

  1. Click
  2. Wait for a new file in a downloads folder

The problem is that some websites show an alert or some other dialog, and you need to close it to start downloading the file. Generally, you might need to perform some action to start the download process.

Now you can close the alert:

File downloadedFile = $(byText("Download me with alert")).download(
      using(FOLDER).withAction(
        clickAndConfirm("Are you sure to download it?")
      )
    );

or perform any other action:

File downloadedFile = $(byText("Download me with alert")).download(
    using(PROXY).withAction((driver, link) -> {
      // add cookies
      link.click();
      // driver.switchTo().window();
      // alert.dismiss();
      // send http request
      // call api
    }));

See issue 1479 and PR 1481.



We improved condition textCaseSensitive

… to support selected options in a <select> element - similar to Condition.text.

Thanks to Oleg Berezhnoy for PR 1482.



We added selectors byTextCaseInsensitive and withTextCaseInsensitive

… for finding elements by text ignoring case.

Before

Selenide has methods for finding elements by text (case sensitive) for a long time:

  • by the whole text: $(byText("Wake up we have a tsar again")
  • by substring: $(withText("we have a tsar")

These selectors are case sensitive (and use XPath 1.0 inside).

After

Now we have added similar methods, but case insensitive:

  • $(byTextCaseInsensitive("wake UP we have a TSAR again")
  • $(withTextCaseInsensitive("TSAR agAiN")

These selectors can find element by text ignoring the case.

Technical nuance

we could not implement this feature by XPath because string functions like lower-case and match were added in XPath 2.0, but all popular browsers support only XPath 1.0. That’s why we had to write a tricky JS code to walk through the DOM tree.

See issue 1380 and PR 1381.



We added method Driver.getSessionId()

Basically it’s needed in Selenide-Selenoid integration.

Thanks to Petro Ovcharenko for PR 1483.


We shortened default webdriver timeouts

There are two very strange timeouts inside of Selenium webdriver. I think it’s a problem that they are abnormally large. And you cannot change them.

Here are these default timeouts:

  • connect to a webdriver: connectTimeout = 120000 ms = 2 minutes
  • any webdriver request: readTimeout = 10800000 ms = 3 hours (!)

If some webdriver command hangs for whatever reason, your test will wait for 3 hours. For example, it happens when we test an Electron application and it goes to the system tray. The test tries to take a screenshot and hangs for a long time. I really don’t understand, is there anybody who thinks it’s reasonable?

In Selenide 5.22.0 we added possibility to change these default timeouts (it uses complex reflection under the hood).
And we made these timeouts fewer (though they are still too conservative in my mind):

  • connectTimeout = 1 minute
  • readTimeout = 2 minutes

Let’s consider it as a workaround and hope Selenium 4 brings a proper solution.

See PR 1433.


selenide-selenoid 1.1.3

We released an update selenide-selenoid:1.1.3 which fixes ClassCastException in some cases.

Thanks to Petro Ovcharenko for PR 10.


selenide-appium 1.6.6

We released an update selenide-appium:1.6.6 which upgrades to Selenide 5.22.0


News

Wow! Several famous guys posted their videos about Selenide.

And a couple of older materials:


And for dessert, the younger generation teaches Selenide:


Andrei Solntsev

selenide.org

08.06.21