Я пытаюсь сделать скриншот с кодом ниже:Скриншот в Selenium
public void screenShot() throws IOException, InterruptedException { //Take screenshot and save to file
File scr=((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE); //Destination where to store screenshot
File dest= new File("filepath/Visionscreenshot_"+timestamp()+".png"); // Copy the file to system ScreenshotPath
FileUtils.copyFile(scr, dest);
Thread.sleep(1200);
}
public String timestamp() {
return new SimpleDateFormat("YYYY-MM-DD HH-mm-ss").format(new Date());
}
Я получаю эту ошибку:
Exception in thread "main" java.lang.NullPointerException at Vision.Screenshot.screenShot1(Screenshot.java:37)
Ошибка: thread "main" java.lang.NullPointerException at Vision.Screenshot.screenShot (Screenshot.java:37) – Sneha
Что такое строка 37? – nullpointer
это 'File dest = new File (" filepath/Visionscreenshot _ "+ timestamp() +" .png "); 'не кажется правильным. Существует ли путь 'filepath/Visionscreenschot' даже существует? – nullpointer