Je le code suivant écrit en Selenium/Java
mais je veux paramétrez ce code et ajouter le nom de la balise pour laquelle la capture d'écran est prise:Comment prendre capture d'écran dans le concombre en utilisant le nom de tag
@Then("^Take Screenshot$")
public void tearDown() {
// take the screenshot at the end of every test
String location = "D:/ubdd/screenshots/";
DateFormat dateFormat = new SimpleDateFormat("dd-mm-yyyy h-m-s");
Date date = new Date();
File scrFile =
((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
// now save the screenshto to a file some place
try {
FileUtils.copyFile(scrFile, new File(location +
dateFormat.format(date)+".png"));
System.out.println("Screenshot saved");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Bienvenue dans StackOverflow! Veuillez consulter les [guides pour poser des questions] (https://stackoverflow.com/help/asking), en particulier [comment créer un exemple minimal, complet et vérifiable] (https://stackoverflow.com/help/mcve) – AesSedai101