I see a post was made for this here How to capture a screenshot after each step in tests with JAVA and Cucumber?
But, what I would like to do is be able to take a screenshot after every single action taken even within a single Cucumber step and embed into the Cucumber report. In other words, there are multiple actions taken in a single step to satisfy that step and I would like to embed the screenshot for all of them. Is this possible? If so, how?
You can use the @BeforeStep or @AfterStep cucumber annotation in your hook class and then call you screenshot method inside it.
public class Hooks{
@BeforeStep
public void beforeEachStep(){
takeScreenshot();
}
}