Released Selenide 6.5.0

Released Selenide 6.5.0

setValue remastered

Good night!

We released Selenide 6.5.0.

Now you can mask passwords in reports

Sometimes you need to type passwords and other sensitive data into input fields. Sometimes people don’t want this data to be visible in test reports (e.g. Allure or TextReport). And ask to hide this sensitive data somehow.

I personally never understood why it’s a problem.
Why the password from test environment should be a problem?
You don’t use the same password in production, right?
You don’t run tests in production, right?

Anyway, we made it possible to mask sensitive data in test reports:

                                         // replaces by "********"

  $("#username").setValue(withText("john").withDisplayedText("J* username"));
                                         // replaces by "J* username"

See issue 1768 and PR 1770.

Now you can easily pick a date in <input type=date>

It’s not a trivial task to pick a date in Selenium.

When your application has element like <input type=date>, and your test tries to click it, different browsers open different calendars and use different date formats. In theory, they should use format based on user settings, but in reality each browser plays its own game.

This causes flaky tests that might work on your machine, but occasionally fail on others.

As a result of my investigation, I found that the only stable way to pick a date is setting a value in format yyyy-mm-dd using JavaScript snippet. It seems to work in all OSs and browsers.

Now you can easily do it with new method withDate:

  LocalDate birthday = LocalDate.parse("1979-12-31");

See issue 1753 and PR 1770.

Now method $.setValue("") supports React, Vue.js etc.

Standard Selenium method WebElement.clean() (e.g. it’s used in Selenide method $.setValue()) doesn’t always work when the application uses some tricky constructions (generated by React/Vue/…) instead of standard <input>.

Hopefully, we have fixed it. Waiting for your feedback.

Now the following 2 methods abandoned using WebElement.clear(). They use key combinations instead:

1. Method $.clear():

input.sendKeys(HOME, chord(SHIFT, END), BACK_SPACE);

2. Method $.setValue(""):

input.sendKeys(HOME, chord(SHIFT, END), BACK_SPACE, TAB);

This new way seems to work in all OSs and browsers.

See issue 1497 and PR 1787.

Thanks to Alexei Vinogradov for the research in PR 1499.

Removed triggering duplicate blur and change events

As a result of previous change, method $.setValue("blah") triggers blur and change events only once.

Before this release, method $.setValue("blah") worked in two steps and therefore triggered events twice:

  • Step 1. $.clear() // triggered blur and change
  • Step 2. $.sendKeys("blah") // triggered blur and change once more

The events triggered on the first step could cause unexpected effects, including disappearing of the field itself.
See issue 960.

Trigger blur on a previous element

During working on the previous change, we improved method $.setValue("blah") so that it triggers blur event on a previous active element. At least it helped to fix some of our flaky tests. Hopefully, it can improve your tests as well.

See issue 1784 and commit 593e6fc9005.

Now method $.setValue() and $.append() check that element is not disabled or readonly

See issue 1523 and PR 1787.

Added conditions “interactable” and “editable”

These conditions existed inside of Selenide, but were not available to end-users.
Now you can also use them:

             // interactable = visible OR "opacity: 0"

             // editable = interactable AND enabled AND !readonly

See issue 1523 and PR 1787.

Method $.download(FOLDER) waits for full download completion

Sometimes test might be flaky when it tries to download a file which is being downloaded very slowly. Selenide might detect and copy the file in C:\Downloads folder which is not fully downloaded yet.

Now Selenide waits until C:\Downloads doesn’t contain any files “.crdownload” (for Chrome) or “.part” (for Firefox). This is a temporary file created by the browser for a short period of time while the file is beging downloaded.

See issue 1779, PR 1804 and PR 1769.

Added method stream() for collections

Actually, method $$.stream() already existed, but was deprecated in version 6.2.0. Now you can pick one of two non-deprecated replacements:

  • $$.asFixedIterable().stream()
  • $$.asDynamicIterable().stream()

See issue 1773 and PR 1774.

Remove Selenium built-in OpenTelemetry

If I am not mistaken, this “telemetry” was added Selenium 4. I have no idea why it’s needed, but it could interfere with someone who already had their own telemetry.
It was simpler for us to remove it than support both. :)

Thanks to Petro Ovcharenko and Aliaksandr Rasolka for PR 1763.

Upgraded dependencies

By the way LittleProxy projects moved to a dedicated github organisation, and I became the main maintainer of the project. I was never a big fan of proxies, but LittleProxy is used inside of Selenide, and somebody needs to maintain it…

UPD Selenide 6.5.1

A small update Selenide 6.5.1:

  • #1808 Fixed $.clear() so that it doesn’t press tab anymore – see PR #1809
  • #1806 Bump browserup-proxy-core 2.1.4 to 2.1.5

UPD Selenide 6.5.2

#1497 Fixed method $.clear() on a fresh Firefox: now it presses “Ctrl+A -> Delete” instead of “Home -> Shift+A -> Delete”. See PR #1838.

Stay tuned!

Andrei Solntsev