Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. package Utilidade;
  2.  
  3. import java.io.File;
  4. import java.io.IOException;
  5. import java.text.DateFormat;
  6. import java.text.SimpleDateFormat;
  7. import java.util.Calendar;
  8.  
  9. import org.apache.commons.io.FileUtils;
  10. import org.openqa.selenium.OutputType;
  11. import org.openqa.selenium.TakesScreenshot;
  12. import org.openqa.selenium.WebDriver;
  13.  
  14. public class ScreenShot {
  15.  
  16. public void nomeEvidencia(String nomePasta, String cenario) {
  17.  
  18. }
  19.  
  20. public void capturaTela(WebDriver driver, String nomePasta, String cenario) {
  21. File src = ((TakesScreenshot) driver).getScreenshotAs(OutputType.FILE);
  22. try {
  23. DateFormat dataFormato = new SimpleDateFormat("ddMMyyyy HHmmss");
  24. Calendar data = Calendar.getInstance();
  25. nomeEvidencia(nomePasta, cenario);
  26.  
  27. FileUtils.copyFile(src,
  28. new File(/* C:/Users/Auditeste0232/Desktop/ */"Z:/Projetos/PPU - Integração/" + nomePasta
  29. + "/Evidencia" + cenario + dataFormato.format(data.getTime()) + ".png"));
  30. // COPIAR FileUtils.copyFile(new File("c:/TESTE/"), new
  31. // File("c:/teste2/'NomeDoArquivo"));
  32.  
  33. } catch (IOException e) {
  34.  
  35. e.printStackTrace();
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement