Selenium webdriver 从浏览器页脚打开下载的文件capybara selenium

Selenium webdriver 从浏览器页脚打开下载的文件capybara selenium,selenium-webdriver,capybara,Selenium Webdriver,Capybara,有没有办法从页脚栏打开下载的文件 我正在编写测试来测试在Chrome中下载的pdf。我还想打开文件以确认其中的内容 如果文件下载位置默认为某个位置,谢谢 您可以使用以下方法进行交叉检查 File f = new File("PathToFileorDirectory"); if (f.exists() ) { Process p = Runtime .getRuntime() .exec("rundll32 url.dll,FileProtoc

有没有办法从页脚栏打开下载的文件

我正在编写测试来测试在Chrome中下载的pdf。我还想打开文件以确认其中的内容


如果文件下载位置默认为某个位置,谢谢

您可以使用以下方法进行交叉检查

File f = new File("PathToFileorDirectory");
if (f.exists() ) {
    Process p = Runtime
           .getRuntime()
           .exec("rundll32 url.dll,FileProtocolHandler "path of PDF file"");
   p.waitFor();
    }
else
system.out.println("File does not Exist");