Skip to content

Instantly share code, notes, and snippets.

@erdemkiiliic
Last active June 27, 2023 21:05
Show Gist options
  • Save erdemkiiliic/cf88d1843f9fe7597d27b3b29f275bef to your computer and use it in GitHub Desktop.
Save erdemkiiliic/cf88d1843f9fe7597d27b3b29f275bef to your computer and use it in GitHub Desktop.
Capturing a screenshot after each step in Gauge that doesn't contain "VI" and "verify" in the step name.
@AfterStep
public void saveScreenshot(ExecutionContext context) {
if (WebDriverManager.getInstance().getWebDriver() != null) {
if(!(context.getCurrentStep().getDynamicText().contains("VI")) && !(context.getCurrentStep().getDynamicText().contains("verify"))) {
waitHelper.waitUntilPageIsReady();
Gauge.captureScreenshot();
log.warn("Screenshot captured!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment