Multiple sessions screenshot on failing

Hello,
is there a way to save a screenshot of each session() created on the scenario after failing?

Feature("Testing");

Scenario("Screenshot multiple sessions", (I) => {
	session("one", () => {
		I.amOnPage('http://google.com');
		I.dontSeeInCurrentUrl('http://google.com');
	});
        session("two", () => {
		I.amOnPage('http://google.com');
		I.dontSeeInCurrentUrl('http://google.com');
	});
        session("one", () => {
		I.dontSeeInCurrentUrl('http://google.com');
	});
});

I think we already had it. But only with Puppeteer and Playwright.

Oh, I’m working with selenium webdriver…

I can create a custom helper and initialize a new webdriver on it and finally add the screenshot to the _failed(), but I don’t think is the best approach, right?
Sessions are a way easier to work with.

Is it possible to have the same result with on webdriver? Or to have a work around?

I guess codeceptjs would offer this in their new release.

1 Like