0

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

Cleicy Guião
  • 111
  • 1
  • 20

1 Answers1

0

You can use google for such common questions.

Here you go: https://www.guru99.com/take-screenshot-selenium-webdriver.html

Infern0
  • 2,565
  • 1
  • 8
  • 21