Released Selenide 7.16.0

Released Selenide 7.16.0

Selenide MCP server
10.04.26

Hello!

Who’s up for a Friday release of Selenide 7.16.0?

A whole civilization of old-school manual test writers will perish tonight and will never come back. I don’t want that to happen, and I feel sorry for these slow guys, but it probably will. Sad!


Selenide MCP server

It’s happening, folks!

I’d been postponing this day as long as I could. I didn’t believe in AI. I resisted. My head is still full of fresh memories from August 29, 1997.

But I gave up. To hell with it. Let it be.


Introducing Selenide MCP server

In short, MCP gives an AI access to Selenide methods.

What for? Who the hell knows. Well, it lets the AI run Selenide methods and write tests for you (as if writing tests with Selenide had ever been hard in the first place!)

Or fix locators. Or find elements that don’t have good locators. Or try out a new design for your web pages. God knows what you meat bags use MCP for.

How to try it

Now in any folder, in any project, you can create file .mcp.json:

{
  "mcpServers": {
    "selenide": {
      "command": "npx",
      "args": [
        "selenide-mcp@7.16.0"
      ]
    }
}

And then launch some AI (I tried Claude, myself) and tell it:

> claude
> /mcp enable selenide
> Slave, crank me out some tests for https://todomvc.com/examples/react/dist/

And it will crank them out. Tremendous tests. The best tests. Believe me.

Thanks

  • Thanks to Mikalai Alimenkou for the AI masterclass (there’s a video too)
  • Thanks to my colleague Aleksei Krassilnikov for sitting down next to me and showing me how all this AI witchcraft is done.

    The two of us, with the help of our AI, vibe-coded Selenide MCP for your AI. What a time to be alive


See issue 3091 and PR 3291.


WebSockets in Selenide proxy

Well, that’s it — the vibecode is flowing through the pipes. Without AI, I’d probably never have pulled this one off.

Anyway. Selenide has a built-in proxy that can listen to (and even modify) traffic between the browser and the backend. Useful for downloading files, authentication, logging, mocks and a whole lot more.

But up until now this proxy didn’t support websockets. If your web app sends messages over websockets, they wouldn’t get through while the proxy was enabled.

Now they do! And you can even listen to them (and, say, log them or verify them). Like this:

Configuration.proxyEnabled = true;
open("https://test.mybank.com");
getSelenideProxy().getProxy().addWebSocketListener((frame, message) -> {
  log.info("WebSocket opCode: {}, text: '{}', url: {}", frame.getOpcode(), frame.getTextContent(), message.getUrl());
});

To make it happen, my AI-slave and I had to tweak a couple of things both in LittleProxy and in BrowserUpProxy.

Thanks to Valery Yatsynovich for maintaining the BrowserUpProxy project and for the quick releases.


Searching element by label

For half a year now Selenide has had a way to search for an element by its label:

$(byLabel("Song title")).val("Swan Lake");

There was a tiny bug in there: if an element with the given text was found but it wasn’t a <label> — just some scruffy little <div> — things went sideways. Well, we fixed it. And we even managed it without AI.

See issue 3280 and PR 3282.


CDP download with multiple tabs

Selenide can download files in several different ways, one of which is by listening to CDP events. But if the test had already opened a few tabs in the browser, Selenide would sometimes start listening to events in the wrong tab — and so it never got the signal that the file had finished downloading.

Anyway, we’ve fixed this one too.

See issue 3283 and PR 3284.


Handling alerts in Firefox

I didn’t really figure out what happened, but it looks like the new version of Firefox has changed its behavior around alerts. Those wretched little modal popups that old-school devs still sometimes shove onto their pages. Long story short, we changed the “behavior for unhandled alerts” setting for Firefox from “accept” to “ignore”.

It probably won’t change much, but keep it in mind. Just in case all your tests start falling apart because of alerts. :)

See PR 3285.


Disabled “form resubmission confirmation dialog” in Firefox

Continuing on the previous topic. We disabled the “form resubmission confirmation dialog” in Firefox by default. It’s one of those modal dialogs. It feels like it never used to pop up, and then all of a sudden it started popping up (for instance, on a page refresh) and breaking tests, so we had to shut it down.

See PR 3285.


$.ancestor() with multiple class names

Selenide has long had a method $.ancestor(".container") (also known as $.closest(".container")), which finds the nearest ancestor by class name, tag or attribute.

And now you can find an ancestor by several class names at once:

SelenideElement parent = `$.ancestor(".container.table.active")`;

See PR 3286.


Video recorder

The next batch of fixes is about our video recorder. Yeah, videos — nobody knew videos could be so complicated.

Video recorder with a custom webdriver

Originally, the video recorder only worked with the built-in Selenide webdriver (which, by the way, we recommend everyone use). But if you had set your own custom webdriver via WebDriverRunner.setWebDriver(), the video recorder just couldn’t see it. And the resulting video came out empty.
On top of that, Selenide would cheerfully write a fake “Video recorded” message — even though no video existed. :)

These problems have now been fixed.

  • The custom webdriver from WebDriverRunner.setWebDriver() is now also visible to the video recorder.
  • If the video didn’t actually record, the lying “Video recorded” log won’t show up.
  • If CDP failed for some reason (for example, a suitable CDP version wasn’t found on the classpath), the video recorder falls back to the standard webdriver screenshot method (it’s slower and steals focus, but at least it works).

See issue 3278.
Thanks to Kamil Pająk for PR 3279.


Gaps in recorded videos

I only noticed this one recently, even though in theory it should have been around for half a year already. When you run a test in Chrome with the video recorder enabled, sometimes 4-second gaps show up in the video.

My AI-slave and I debugged the whole thing thoroughly and figured out that this happens at the exact moments when Chrome is refreshing the page or navigating to another page.

Here’s how it went down:

  • the video recorder sends Chrome a CDP command “captureScreenshot” and waits for a response (with a 4-second timeout!)
  • the web page refreshes
  • in Chrome the old CDP context disappears and a new one shows up
  • Chrome can’t respond to the CDP command — and, the jerk, doesn’t send back an error either.
  • the video recorder waits its full 4 seconds (taking no screenshots the whole time), and only then the CDP command fails by timeout. And only after that does the video recorder go back to taking the next screenshots.

It looks like a Chrome bug, and there’s no simple, clean fix in sight. So we just reduced the screenshot timeout to 300ms. The gaps in the videos will still be there, but they’ll be almost invisible ¯¯_(ツ)_/¯¯

See PR 3297.


Upgraded Selenium from 4.41.0 to 4.43.0

And bumped the CDP version from v145 to v147.

Changelog

See PR 3294 and PR 3296.


MAKE JAVA TESTS
GREAT AGAIN!



Andrei Solntsev

selenide.org

10.04.26