Posted
about 8 years
ago
Hi all!
It happened, finally!
After 3-years-length waiting, Selenium Webdriver 3.0 was released.
And we released Selenide 4.0.
What changed?
Actually nothing should change for you. They just cleared some legacy
garbage from selenium (that was
... [More]
never used by Selenide).
What is actually important that Selenide now requires Java 8.
Hurrra!!! Now QA world will finally move to Java 8 and lambdas!
Can I get more details!
Sure. Here is a list of selenium webdriver 3.0.0 changes.
News
About another major upgrade for unit-tests: Migration to Mockito 2.1
About old good things: Spring boobs
Great portal for developing your testing skills
Let’s upgrade!
Andrei Solntsev
selenide.org
[Less]
|
Posted
about 8 years
ago
Good evening!
We released Selenide 3.11!
This is the last release in 3.x series. The last working on Java 7 and Selenium webdriver 2.x
The following is Selenide 4.x: selenium webdriver 3.x and Java 8.
So, what we have in Selenide 3.11:
Added
... [More]
condition checked
Now you can write readable test for checkbox:
$("#i-agree").shouldBe(checked);
Before now, you had tow write $.shouldBe(selected) which is not pretty clear.
Checkbox should be checked.
See issue 416
Optimization of getMessage()
There is a strange behaviour in Selenium.
When you get any exception from webdriver (any subclass of SeleniumException), its method getMessage() is called.
And method SeleniumException.getMessage() tries to be too smart.
It tries to add IP and host name of current machine to the error message.
And detecting host name can be very slow.
And it appeared that Selenide does call this method multiple times.
I believe that getMessage() should not this. It’s not its business.
But all we can do is just to optimize getMessage() calls, so that Selenide
would not call this method multiple times.
So we did it.
See issue 415
Waiting for Selenium 3.0…
Andrei Solntsev
selenide.org
[Less]
|
Posted
over 8 years
ago
Hi!
People often ask if they can use BDD with Selenide.
Short answer: Yes, you can!
There is plenty of BDD tools in Java and Python. You can use any of them with Selenide.
Some working examples:
Selenide + Cucumber:
... [More]
https://github.com/selenide-examples/cucumber/tree/master/src/test/resources/org/selenide/examples/cucumber
Selenide + JBehave:
https://gist.github.com/mp911de/009ea539271da0633c59
Selenide + GEB:
https://github.com/selenide-examples/geb-maven-tutorial/blob/master/src/test/groovy/stepdefs/IndexStepDefs.groovy
Selenide + Gauge:
https://github.com/selenide-examples/GaugeSelenideExample/blob/master/specs/example.spec
You can find a whole book here full of examples with Selenide, JBehave and Cucumber:
https://www.amazon.com/Test-Driven-Java-Development-Viktor-Farcic/dp/1783987421?tag=viglink12630-20
P.S. I personally don’t value BDD really much. I think it’s a nice idea, but it doesn’t really work. Business stakeholders do not really write executable specifications.
Обновляйтесь!
Andrei Solntsev
selenide.org
[Less]
|
Posted
over 8 years
ago
Hi!
We released Selenide 3.10!
Proxy server is disabled by default
It’s
I am sad to say this, but it seems that the experiment with a proxy server has not yet succeeded.
There is a problem with the “new way” of downloading files using Selenide
... [More]
built-in proxy server.
It works for all my projects, but some folks reported that it doesn’t work for them.
I still don’t know exactly the problem and its causes.
Probably those who use Selenium Grid experience this problem.
Anyway, now we reverted default downloading mechanism to HTTPGET.
If you need to use proxy server, enable it via system property:
-Dselenide.fileDownload=PROXY
Or directly in your code:
Configuration.fileDownload = PROXY;
By the way, we fixed issue 393:
Selenide will not even try to run proxy server until fileDownload=PROXY is set.
Added support for multiple selects
There are dropdown lists that allowing selecting multiple options ().
Now it’s easy to select multiple options in Selenide with just one command:
select.selectOption("Margarita", "Theodor Woland"); // by test
select.selectOption(0, 2, 3); // by index
select.selectOptionByValue("cat", "woland"); // by value
We also added a method for getting all selected options:
select.getSelectedOptions().shouldHave(texts("Margarita", "Theodor Woland"));
См. issue 400
Now you can print report only for failed tests
As you probably know, in Selenide you can print report of all executed steps .
Now you can configure if it should be printed only for failed tests. Or only for succeeded tests. Or always.
For JUnit:
@Rule
public TestRule report = new TextReport().onFailedTest(true).onSucceededTest(false);
For TestNG:
@Listeners(TextReport.class)
public class GoogleTestNGTest {
@BeforeMethod
public void setUp() {
TextReport.onSucceededTest = false;
TextReport.onFailedTest = true;
}
}
See. issue 408
Fixed bug with parsing http header Content-Disposition containing encoding
Now Selenide uses correct file name even if header Content-Disposition contains encoding:
Content-Disposition: filename=Prices.csv;charset=UTF-8
See. issue 398
Fixed bug 401: “Selenide swallows exception in some cases”
Never ever write catch (Throwable). Never!
See. issue 401
Method open(url) now works for URL in upper case
It’s weird, but sometimes people want to enter url in upper case.
And they found that Selenide could not open such urls. Ups.
Now we fixed it: issue 407
Uncommented one old test
See. issue 379
News
Test mobile? Now it’s easy! Examples of Selenide+Appium
Yes, you can use Selenide for testing mobile applications!
Let’s upgrade!
Andrei Solntsev
selenide.org
[Less]
|
Posted
over 8 years
ago
Good evening!
We released Selenide 3.9.2!
You can download files differently
As you know, we changed a way of downloading files in Selenide 3.9.
We got quite different feedback: some folks reported that new way works for cases where old way
... [More]
didn’t work,
while others reported that the new way doesn’t work for cases where the old way worked.
That’s why we decided to provide users a choice.
Now you can choose how to download files.
“New” way - PROXY
This way is enabled by default.
It downloads files using selenide’s own embedded proxy server.
Pros:
This was is better because it’s more universal: it not only works with elements, but
with any other elements too. Actually it doesn’t depend on web elements at all.
It just intercepts all server responses containing files.
Cons:
If you run your own webdriver instance (and add it to Selenide using method setWebDriver()),
it knows nothing about selenide proxy server, which cannot intercept server responses.
We will think how to improve this situation.
“Old” way - HTTPGET
If you need to use the “old” way, just add system property -Dselenide.fileDownload=HTTPGET.
Or directly in the code:
Configuration.fileDownload = HTTPGET;
Pros:
It works independently from selenide proxy server.
Cons:
It works only with elements, and can execute only GET requests.
It may not work if the machine that runs your tests doesn’t have access to a server from which files are downloaded.
Now you don’t have excuse not to upgrade to Selenide 3.9.2
Statistics update
Selenide download statistics for August 2016:
Andrei Solntsev
selenide.org
[Less]
|
Posted
over 8 years
ago
Hi all!
We released Selenide 3.9.1!
Killer feature! Selenide can now download any files. From anywhere.
We planned to do it for a long, and now it finally happened!
Those endless problems with downloading files in Selenium are over.
Now it’s
... [More]
easy. Just one simple method for all cases:
File report = $("input#submit").download();
Actually method download existed in Selenide for a long time.
But it could only download files from links with href attribute: .
It was good, but not enough in some cases. For example:
Button click submits a form - resulting in downloading a file
Button click opens a PDF in new tab (“inline” mode - browser built-in PDF viewer)
Now Selenide can download any files in all these cases.
To make it possible, Selenide run a built-in proxy server
(namely, BrowserMobProxy).
How downloading works:
Test executes command $("selector").download();
Selenide activate the proxy server
Selenide clicks the element
Proxy server catches all server responses that contain http header Content-Disposition.
Selenide extracts file name from this header, and saves corresponding file to folder build/reports/tests.
Selenide waits (up to 4 seconds) until at least one file gets downloaded.
Method $.download() return the first downloaded file.
If some new tabs/windows has been opened meanwhile (during steps 1-6), Selenide will closes all of them.
It’s needed for cases when PDF gets opened in a new tab.
See issue #196 and
pull request #267.
Huge thanks to Dmitrii Demin for his commitment to this feature, suggestions and discussions!
Selenide proxy server
Yes, now Selenide runs its own proxy server when running tests.
In future we can use it for implementing other useful features.
For example, we could check http statuses of pages and other resources.
We could inject own code into pages etc.
Please share your ideas, let’s brainstorm!
Warning about too large requests/responses
Now Selenide tracks size of requests and responses.
If some of them exceeded 2 MB, Selenide will write a warning in logs.
This is experimental feature. Please share your experience with it.
Dd you get new knowledge? Did you have some problems with it?
See issue #383
Now SoftAsserts listener works correctly with TestNG
We found that TestNG is a bad boy. Really, it has some really weird issues.
For example, if you declare @Listeners(SoftAsserts.class) in some of your test classes,
TestNG will automatically apply SoftAsserts listener to all of your tests. Unbelievable!
We created a workaround for this problem. Now SoftAsserts listener will check
if the current test (or its parent) really declares annotation @Listeners(SoftAsserts.class).
See issue #384
Now SoftAsserts TestNG listener ignores tests with attribute “expectedExceptions”
Let me describe the problem. Suppose you have a test:
@Listeners(SoftAsserts.class)
public class MyTest {
@Test
public void myCheckA() {...}
@Test(expectedExceptions = ...)
public void myCheckB() {...}
}
Obviously, SoftAsserts mode should be used in method myCheckA,
but should not be used in method myCheckB. Because myCheckB
expects some specific error, and SoftAsserts would break the whole flow if it caught the error.
See issue #372
Fixed bug with basic auth in IE browser
See issue #366 and
pull request #369
Thanks to Anton Aftakhov for this pull request!
Upgraded to gson 2.7
Selenium uses quite old gson 2.3.1, but sometimes you want to use a newer one.
News
My interview on popular russian IT portal: About legacy code
Why programmer cannot be a good tester
Released video-recorder 1.0.8 - a really cool thing! Now production ready.
Let’s upgrade!
Andrei Solntsev
selenide.org
[Less]
|
Posted
over 8 years
ago
Good night!
We released Selenide 3.8! It fixes some small issues and introduces small but useful features.
Fixed file uploading on remote browsers in Grid
Thanks to Alexei Vinogradov for fixing remote upload!
Now you can disable automatic
... [More]
creating of *.html files
When your test fails, Selenide automatically saves 2 files:
Screenshot - *.png file
Page source code - *.html file
But sometimes people don’t want to save *.html files. For example, in case of
single page application the page source contains html code of all application pages. Thus it’s too big and useless.
Now you can disable saving html files. As usually, via system property:
mvn test -Dselenide.savePageSource=false
or directly in your code:
Configuration.savePageSource = false;
Thanks to Boris Osipov for this pull request!
Added method $.dragAndDropTo(WebElement)
Until now, Selenide had only method $.dragAndDropTo(String),
where string parameter is CSS selector of target element.
But sometimes you want to define target element in another way.
Now you can use the new method $.dragAndDropTo(WebElement). For example:
SelenideElement target = $(byText("Drop here"));
$("#from").dragAndDropTo(target);
See issue #355
Now TestNG annotations SimpleReport and SoftAsserts are thread-safe
If you use annotations SimpleReport or SoftAsserts and TestNG framework,
and run tests in parallel, you could see an empty report sometimes.
Or you could get ConcurrentModificationException time-to-time.
It appeared that TestNG is bad boy. Just bad.
If you declare @Listener(SoftAsserts) for one test class, TestNG
creates a single instance of SoftAsserts and uses for ALL tests (even parallel).
As opposite, JUnit is cool guy. It creates a new instance of every test class and every Rule
before running every next test method. Thus it avoids dependencies between tests and
random failures because of previous tests.
We have fixed this problem. Now SoftAsserts listener can work in several parallel threads.
Even in TestNG.
See issues #364 and
#303.
Added new methods to class Selectors: byCssSelector() and byClassName()
I am still not sure that it’s really needed, but people asked for it many times.
No Selectors has by* analogues for all selenium By.* methods.
See issue #360.
Fixed JavaScript error when running Edge browser
Now you can run your Selenide tests with the new Microsoft browser Edge.
People say it should be quite fast.
See issue #339.
Now method $.screenshot() saves screenshots in a right place
Selenide has method for saving screenshot of a single element (not a whole page):
String screenshotFile = $("#footer").screenshot();
The problem is that this method saved screenshot to the project root.
Now it’s fixed, and saves screenshot to the right place - build/reports by default.
See issue #290.
Added protection against invalid soft asserts usages
Now Selenide will throw an exception if you enable “Soft asserts” mode,
but forget to add SoftAssert annotation to your test classes.
See issue #302.
We added link to implementation to all SelenideElement methods’ javadoc
For example, method $(“input”).setValue(“hello”)
is actually implemented in class SetValue
See issue #367.
Upgraded to htmlunit 2.23
See htmlunit release notes
News
Article about Selenide in Spanish by Dario Lamy
Why developers must be good testers
New cool conference in Saint-Petersburg: Heisenbug - looks promising, I am going to speak there
New cool article from Uncle Bob: The Churn
What is a true hardcode
True page objects
For dessert
And for dessert - a fresh joke about Chuck Norris:
Chuck Norris does not use Selenide.
Chuck Norris writes tests in pure Selenium webdriver.
Chuck Norris is immortal - he has enough time for this.
Let’s upgrade!
Andrei Solntsev
selenide.org
[Less]
|
Posted
over 8 years
ago
Hi all!
We released Selenide 3.7!
Upgraded to Selenium 2.53.1
It should fix the problem with Firefox 47.
Added support for Marionette browser
To run your tests with Marionette browser, you can set parameter in command line (or build script):
... [More]
-Dselenide.browser=marionette
or set browser directly in your tests:
Configuration.browser = "marionette";
see. pull request #349
Thanks to Geroen Dierckx for this pull request!
Added support for non-web drivers
There are some “webdrivers” that do not actually drive web-browsers, but
native Windows applications (Winium),
Java Swing applications (Marathon),
and even mobile applications (Appium).
Naturally, these drivers do not support JavaScript.
It appeared that Selenide could not work without JavaScript.
In Selenide 3.7, we have fixed this problem. Now Selenide should work with non-web drivers.
see. issue #345
Removed useless message Screenshots: if screenshots are disabled
see. pull request #357
Thanks to Boris Osipov for this pull request!
Statistics update
Selenide download statistics for June 2016:
And unique IPs statistics:
It’s still growing!
Andrei Solntsev
selenide.org
[Less]
|
Posted
over 8 years
ago
Good day!
In the last day of spring, we released Selenide 3.6.
Reverted page loading strategy to normal
In Selenide 3.5 we set default page loading strategy to none.
It made tests faster for some users, but other users complained that it broke
... [More]
their tests,
so that they had to rollback to Selenide 3.4.
Now the default page loading strategy is again normal (it’s Selenium default).
If you want to speed up your tests, just configure
-Dselenide.page-load-strategy=none
or
Configuration.pageLoadStrategy = "none";
See issue #321
Now page objects don’t have to be public
… or have public constructor.
public class GoogleSearchTest {
private SearchPage search;
private static class SearchPage {
public ResultsPage searchFor(String keyword) {
$(By.name("q")).val(keyword).pressEnter();
return page(ResultsPage.class);
}
}
}
Make it private. Remove useless constructors. Clean up your code.
See issue #335
Added support for JBrowser webdriver
JBrowser is a new headless browser (like HtmlUnit and PhantomJS).
In theory, it could be faster than usual browsers.
In practice, JBrowser seems to be unusable yet: most of Selenide own tests fail with it.
But you can try it by yourself: -Dselenide.browser="jbrowser".
And you will need to add dependency to your project:
org="com.machinepublishers" name="jbrowserdriver" rev="[0.13.0, 2.0)" conf="test-default"/>
See issue #329
Thanks to Anil Kumar Reddy Gaddam for this pull request!
Method $().download() now uses the standard selenide timeout
Before this change, method $.download() could hang sometimes.
Now it works no longer that 4 seconds (or whatever timeout you configured).
See issue #341
Added support for Basic Auth for all common browsers
You can find usage examples here:
Selenide.open("http://httpbin.org/basic-auth/user/passwd",
"",
"user",
"passwd");
See issue #320
Thanks to dimand58 for this pull request!
Added method $.screenshotAsImage()
It allows to get an image of some element.
It may be useful for debugging, especially when the page is large, and all elements do not fit on the screen.
BufferedImage elementScreenshot = $(".logo").screenshotAsImage();
Thanks to Akkuzin for this pull request!
Fixed TestNG TextReport Listener
now the report will only be generated for classes annotated with @Report.
If I understand correctly, it is a TestNG: if listener is declared in one of test classes, it’s applied to all tests. Like this:
@Listeners(TextReport.class)
It may be a problem if you want to generate a report only for some problematic tests.
Now we fixed it. The report will not be generated for all test classes, but only those annotated with @Report.
Thanks to Alexei Vinogradov for his work on TestNG listeners!
Upgraded phantomjsdriver to version 1.3.0 (compatible with selenium-java 2.53.0)
Unfortunately, PhantomJS Driver project has been asleep for a while.
Its original author Ivan Marino declared that he cannot support the project anymore. :(
That’s why we forked it and released phantomjsdriver 1.3.0,
that is compatible with the latest Selenium Webdriver 2.53.0.
And now this version is included with Selenide 3.6+.
That’s all about Selenide 3.6.
Download and test with pleasure!
Other news
It’s not a fantastic, it’s real: How to use Selenide in C# .NET / Oleg Volodin
One more article about Selenide in Japan / tatesuke
Tutorial: Selenium Tests with Maven and Selenide / Konstantin Pavlov
Statistics
This is Selenide download statistics for May 2016:
The Army of Seleniders is growing!
And what’s up with you?
Andrei Solntsev
selenide.org
[Less]
|
Posted
almost 9 years
ago
Hi all!
We released Selenide 3.5 with flexible collection size checks.
We added flexible checks for collection size
Before now, we could only check the exact size of collection:
$$(".man.angry").shouldHave(size(12));
Now we can use
... [More]
flexible checks: <, <=, >, >=, <>
Simple like this:
$$(".man.angry").shouldHave(sizeLessThan(13));
$$(".man.angry").shouldHave(sizeLessThanOrEqual(12));
$$(".man.angry").shouldHave(sizeGreaterThan(11));
$$(".man.angry").shouldHave(sizeGreaterThanOrEqual(12));
$$(".man.angry").shouldHave(sizeNotEqual(42));
Thanks to vasilevichra for this pull request!
P.S. Actually I am still not sure that this is a good idea.
I think that test must prepare required preconditions before running application.
It means that test must always know exactly how many elements should be on the page at every moment.
But we implemented it because users kindly asked for it.
Speed up of page loading
By default Selenium webdriver waits until all elements of a page (html, script, style, img) are completely loaded.
It may be slow, for example, if there are big images on the page.
And it’s not really needed, especially in case of Selenide that can wait for any expected conditions.
That’s why we used page loading strategy none in Selenide 3.5. It should make your tests faster.
Of course, you still can use any other strategy if you need.
Either by system property:
-Dselenide.page-load-strategy=normal
Or directly in code:
Configuration.pageLoadStrategy=eager;
You can find all available strategies here.
Fixed method toString()
Selenide can print detailed information of web elements.
When you write System.out.println($("option#abc")), you will see a text and all attributes of this element:
id="abc" value="livemail.ru" selected:true>@livemail.ru
It’s really cool feature, and by the way, Selenium cannot do it.
That’s why we had to use dirty JavaScript hacks to print all the attributes.
But we found that this method prints only the initial value of attribute value, even if it has been modified dynamically.
We fixed this problem in Selenide 3.5. Now method toString() always prints out the actual value of value.
Upgraded to selenium-java 2.53.0
Here is selenium 2.53.0 changelog.
News
The historical moment: Selenide has been mentioned in Wikipedia
Yakiv Kramarenko presentation on SeleniumCamp 2016 conference: Selenide Alternative in Practice
Selenide receipts: Appium + Selenide
Post about automation system of the printing company Ardecs Print Activity: Selenide simply offers not to bother
Article about Selenide in Software testing magazine
Article about Selenide from Fabricio Galdino: API Selenide: Developing Functional Tests in Java
Statistics
The following is statistics of Selenide downloads in February 2016:
And number of unique IP:
The army of Seleniders is growing!
We plan next Selenide release pretty soon. We are going to include proxy server BrowserMobProxy in it,
so that Selenide could download files and use other powerful magic.
And what’s up with you?
Andrei Solntsev
selenide.org
[Less]
|