I need to get screenshot step by step on my selenium Webdriver code, but when I insert the getscreenshot code my test stop.
Code:
public class Rule {
protected static WebDriver driver;
public void getscreenshot(String folder, String file) throws Exception {
File screenshotFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(screenshotFile, new File("Evidencias\\"+folder+"\\"+file+".png"));
}}
On Step Class:
public class Steps extends Execute {
@Given("acessei a url do portal")
public void AcessoUrl() {
Execute Executar = new Execute();
Executar.abrirBrowser();
}
@And("cliquei no botao de Login com email")
public void Login() throws Exception {
Execute Executar = new Execute();
getscreenshot("Login","01 - Acessando URL");
Executar.Login();
How can I fix it? Thanks