Released Selenide 5.2.7

Released Selenide 5.2.7

Improvements for Appium and Allure
01.08.19

Good summer everyone!

We recently released several minor Selenide updates: 5.2.5-5.2.7.

Let me speak from my heart why we needed them.


We fixed error messages when running Selenide+Appium

Appium is a webdriver for mobile applications (AndroidDriver, IOSDriver). At a first glance, it seems to be a great idea: use the well-known Selenium WebDriver protocol for testing mobile. But many things that were “standard” and “reasonable” in web, work differently in mobile. Or do not work at all.

Appium for Selenium is like Lobachevsky’s geometry for Euclidean geometry: everything is round and through the ass.

That’s why Selenide could give illegal error messages in case of test failures. When trying to compose an error message, Selenide calls some “standard” methods which always worked in all web browsers: $.getTagName(), $.isDisplayed(), executeJavascript() etc. But which fail in Appium (either Android or iOS or both).

To fix this issue, we had to add several catch (NoSuchElementException | UnsupportedOperationException | UnsupportedCommandException | WebDriverException) blocks which are essentially needed only because of Appium. We needed versions 5.2.6 and 5.2.7 just to add another catch for another corner case.

Now Selenide works better for mobiles. Amen.

See issue 496 - Fix $.toString() in Appium

NB! You can find examples of using Selenide for mobile on github.


Added method open() without parameters

This method just opens an empty browser. Without a URL.

It’s also needed for mobile. Selenide 5.+ requires that browser should be opened before any operations with web elements. But the traditional method open(URL) doesn’t work in Appium - you don’t have any URLs in mobile, you have applications.

It’s a stupid situation, but we found an elegant solution, right? :)

Thanks to yaroslav-orel for PR 956.


Added method because for collections

As you know, to make error messages more readable, you can add a description to any condition. You don’t just say that the button is expected to be blue, but you also explain why you think that it should be blue:

$("#login").shouldBe(disabled);
$("#login").shouldBe(disabled.because("User entered a wrong password 3 times"));

Now we have similar methods for collections:

$$(".cv").shouldHave(size(3));
$$(".cv").shouldHave(size(3).because("Bob has two CVs and John has one."));

Thanks to Roman Kliuha for PR 904


Fixed problem with open inside of open

This is just an anecdotal case. You call method open(url) and get an error:

IllegalStateException: No webdriver is bound to current thread: 19. You need to call open(url) first.

Like, “you can’t call open because you have to call open”.

After a small research we found that the problem was in combination Selenide+Allure.

  1. Selenide tried to open a browser
  2. Selenide failed to open it (e.g. could not find Chrome executable in PATH)
  3. Allure tried to add this even to its log
  4. Allure tried to make a screenshot
  5. Allure asked for screenshot from a “currently opened browser” and got an error.

See fix in


News


Conferences

  • September, 20-21 - I will give two talks at QA Fest conference - Kyiv, Ukraine


Andrei Solntsev

selenide.org

01.08.19