Nod*_*rov 1 java selenium screenshot exception
我正在使用 selenium,我编写了一个方法来截取屏幕截图并将其保存在指定的文件夹中,但它不断抛出异常。为什么?这是我的代码:
public void takeScreenshot(WebDriver driver) throws IOException{
Date date = new Date();
String fileName = new SimpleDateFormat("MM-dd-yy_HH:mm:ss").format(date).concat(".jpeg");
File scrFile = ((TakesScreenshot)driver).getScreenshotAs(OutputType.FILE);
File destFile = new File(SCREENSHOTS.toString().concat(fileName));
FileUtils.copyFile(scrFile, destFile);
}
Run Code Online (Sandbox Code Playgroud)
我收到以下异常:
Exception in thread "main" java.io.FileNotFoundException: C:\Screenshots\09-13-15_02:10:52.jpeg (The filename, directory name, or volume label syntax is incorrect)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
560 次 |
| 最近记录: |