Hello, coldies!
We’ve got a new release Selenide 7.13.0, let’s start the unboxing!
- Sped up downloading files from Selenium Grid
- Download doesn’t wait too long if the link is not found
- Mask credentials in remote URL
- Added method
proxy.cleanupFilters() - Removed warning about response size
- Added prefix to all Selenide proxy filters
- Fixed video rate
- Upgraded Selenium from 4.38.0 to 4.39.0
Sped up downloading files from Selenium Grid
Selenide has method $.download() that downloads a file in the browser, and returns this file.
It’s useful for testing all kinds of reports, Excel and PDF files etc.
This is a highly non-trivial operation in itself. Selenide implements several algorithms under the hood (HTTPGET, PROXY, FOLDER, CDP), each with its own pros and cons. Not all of them, for example, work with a remote browser.
So, the FOLDER method hasn’t worked well with Selenium Grid up until now, especially when the file being downloaded is large (say, over 100 MB). There was also no reliable way to wait for the download to complete.
Things got much better now:
- We can track download completion by file modification date (thanks to PR 16589), and
- Downloading large files has been dramatically sped up (thanks to PR 16627).
I tried downloading files up to 4 gigabytes from the grid – it flew off the server like a cannonball. :)
See PR 3207.
Download doesn’t wait too long if the link is not found
Another improvement for downloading large files. For such files, it’s reasonable to set a long timeout but a small “increment timeout”:
File pdf = $("#report").download(using(FOLDER)
.withTimeout(ofMinutes(10))
.withIncrementTimeout(ofSeconds(5))
.withName("report.pdf"));
In this case, the overall download timeout is 10 minutes, BUT if there are no changes in the download folder within 5 seconds, the method will immediately throw an error.
So, if the #report link wasn’t found at all, the method would wait for 10 minutes.
That’s still too long if the locator was simply wrong.
Now it will fail after 5 seconds.
See issue 3175 and PR 3212.
Mask credentials in remote URL
Getting back to the clouds. Selenide makes it easy to run a browser not only locally, but also “remotely,” i.e., on another machine. On Selenium Grid, BrowserStack, LambdaTest, Saucelabs, Selenoid, Moon, etc.
To do this, you just need to set the remote setting:
Configuration.remote = "https://your-cloud-provider.com/wd/hub";
Sometimes these clouds require authentication, and then the username-password can be written directly into the URL:
Configuration.remote = "https://username:password@your-cloud-provider.com/wd/hub";
The problem is that Selenide was writing this URL to the logs, exposing the credentials.
Now it will mask it:
23:00:10:763 [main] DEBUG WebDriverFactory - Creating webdriver in thread 1:
browser=chrome, browser.version=null, browser.size=1200x960,
remote=http://***:***@localhost:43008/wd/hub
See issue 3210 and PR 3213.
Added method proxy.cleanupFilters()
This is convenient for removing any custom filters added by your tests.
It was already possible with methods proxy.removeRequestFilter(name) and proxy.removeResponseFilter(name),
but now they can be removed more easily, without worrying about names. Simply at the end of each test:
@AfterEach final void done() {
getSelenideProxy().cleanupFilters();
}
See issue 3211 and PR 3215.
Removed warning about response size
When you enable Selenide proxy, among other things, it monitors the size of the server requests or responses, and issues warnings if the size exceeds 2 MB. In the beginning, it seemed like a good idea, but now we’ve decided that it is not Selenide’s responsibility. You probably have more suitable monitoring and optimization tools. And our proxy will work more efficiently without them.
If you really liked these warnings, you can add exactly the same filters to the proxy yourself, in your own tests.
See PR 3215.
Added prefix to all Selenide proxy filters
Selenide has a built-in proxy server that listens to traffic between the browser and the server, allowing you to do all sorts of interesting things with tests. Download files, bypass authentication, spoof server responses, and so on.
To do this, you can add your own filters to the proxy, each with its own unique name (so you can delete them later). Selenide has several filters, which we don’t recommend deleting.
Now they will all have the same prefix “selenide.proxy.filter.”, so you won’t confuse them with your own.
See issue 3211 and PR 3215.
Fixed video rate
Selenide has its own video recorder, in which we recently found a tiny problem. It happened when you requested a high FPS, but had a slow browser.
For example, if you want to generate video with FPS=30, but the browser is slow enough, and can take only 10 screenshots per second, then the final video was 3 times faster than the reality. :)
The video should now be at normal speed.
See issue 3189 and PR 3197.
Upgraded Selenium from 4.38.0 to 4.39.0
Including CDP version update from v142 to v143.
This is a big deal for me personally, as many of my changes made it into this release, and all of them were useful in our release today:
- Download large files from Grid
- Show file modification time
- make augmentation of HasBiDi/HasDevTools lazy-loaded
- add BiDi method BrowsingContext.setViewport(null, null) to reset the mobile emulation mode
- unwrap double-wrapped webdriver
- Avoid logging debug logs with INFO level
- switch DevTools connection between tabs/windows
See PR 3202
Well then — is the holiday already knocking on your door?
selenide.org
14.12.25