Forum Discussion
HiHarithaSaji ,
Can you give me some more details:
- what version of IntelliJ are you using?
- what version of Cucumber are you using?
- are you running your scenarios against an Android device or a simulator (which version)?
- are you running Cucumber from the IntelliJ integration or using a Cucumber runner (e.g. RunCukesTest)?
- please share your CucumberOptions (if using the runner) or a screenshot of the relevant IntelliJ Run/Debug Configuration
Thanks
Seb
Hi HarithaSaji
Try this:
package io.cucumber.skeleton;
import io.cucumber.java.AfterStep;
import io.cucumber.java.Before;
import io.cucumber.java.Scenario;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
public class StepDefinitions {
private TakesScreenshot webDriver;
private Scenario scenario;
@Before
public void before(Scenario scenario) {
this.scenario = scenario;
}
@AfterStep
public void attachScreenshot() {
this.scenario.embed(webDriver.getScreenshotAs(OutputType.BYTES), "image/png", "screenshot");
}
}
If the screenshot doesn't contain what you want, then it's not a problem related to Cucumber, but rather to the tool you are using to take the screenshot (I have assumed WebDriver).
Please also beware that TestComplete (whose forum we're in) and Cucumber are two different products, so please use the Cucumber forum for questions about Cucumber to avoid getting answers about TestComplete 😉
Related Content
- 4 years ago
- 5 years ago