Released Selenide 5.5.1

Released Selenide 5.5.1

Mobile browser emulation

Hi all!

At Black Friday, we released Selenide 5.5.1 with a couple of new features.

We added mobile browser emulation

Sometimes you want to run browser not on a usual Chrome, but on Chrome “like in mobile”.

Like you would open a browser in mobile phone or tablet.

(For example, site looks ugly on mobile. :( We are working on it.)

Now it’s easy to do it by adding a System property before running tests:

java -Dchromeoptions.mobileEmulation="deviceName=Nexus 5"

or right in your code:

System.setProperty("chromeoptions.mobileEmulation", "deviceName=Nexus 5");

NB! We are talking only about one setting - a device name. It should be enough in most cases. If you need to tune other mobile browser settings, please implement WebDriverProvider interface.

See issue 1008 and PR 1011.

We deprecated method Selenide.close()

Selenide always had method Selenide.close(). But its name is misleading: it closes the whole browser, not only a current window. The problem is that Selenium Webdriver also has method close() which only closes a current window/tab (and the whole browser only if it was the only window/tab). And for closing the whole browser Selenium has method quit().

It was my fault that I created method close() without reading Selenium documentation. I was young and didn’t believe in Javadoc. :) But part of the problem is that Selenium names close vs quit are not intuitive. Go figure which of them closes what.

To make your life easier, we now suggest two method with explicit names:

  • Selenide.closeWindow() - closes a current window (or tab, which is the same)
  • Selenide.closeWebDriver() - closes the whole browser

Now you don’t need to remember anything.

The old method Selenide.close() is now deprecated. Going to delete it in Selenide 6.0.0

See issue 1016 and PR 1017.


Andrei Solntsev