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 (
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:
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.
NB! You can find examples of using Selenide for mobile on github.
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? :)
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."));
Fixed problem with
open inside of
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
After a small research we found that the problem was in combination Selenide+Allure.
- Selenide tried to open a browser
- Selenide failed to open it (e.g. could not find Chrome executable in PATH)
- Allure tried to add this even to its log
- Allure tried to make a screenshot
- Allure asked for screenshot from a “currently opened browser” and got an error.
See fix in
- September, 20-21 - I will give two talks at QA Fest conference - Kyiv, Ukraine