code: @After
      public void afterScenario(Scenario scenario) throws InterruptedException {
          log.debug("Scenarion finished");
          ScenarioGlobals scenarioGlobals = getCucumberManager().getCurrentScenarioGlobals();
      	TestEnvironment testNev = getSeleniumManager().getAssociatedTestEnvironment();
      	if (testNev != null && scenarioGlobals != null) {
      		boolean scenarioUsedSelenium = testNev.isWebDriverAccessedSince(scenarioGlobals.getScenarioStart());
      		if (scenarioUsedSelenium) {
      			if (scenario.isFailed()) {
      				log.debug("Scenarion failed while using selenium, so capture screenshot");
      				TakesScreenshot seleniumDriver = (TakesScreenshot) SenBotContext.getSeleniumDriver();
  					byte[] screenshotAs = seleniumDriver.getScreenshotAs(OutputType.BYTES);
  					scenario.embed(screenshotAs, "image/png");
      			}
      		}
      	}
          getCucumberManager().stopNewScenario();
      }
docs: Capture a selenium screenshot when a test fails and add it to the Cucumber generated report
  if the scenario has accessed selenium in its lifetime
  @throws InterruptedException