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 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: <a href
.
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 folderbuild/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. Did 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!
selenide.org
27.08.16