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

Hello again, after the new release i couldn’t figure out how to have both screenshots after failing.

 Feature("Testing sessions");
Scenario("Sessions 1 @level1", async function ({ I }) {
  await I.amOnPage("/");
  session("john", async () => {
    await I.amOnPage("/");
    await I.see("You");
  });
});

Current codeceptjs version: 3.6.4
Output folder:
2024-07-03_11-16

Please let me know if I’m doing something wrong.