一旦点击下载按钮,文件将被下载。在执行下一个代码之前,它需要等到下载完成。 我的代码如下所示:等待下载完成在selenium webdriver JAVA
Thread.sleep(2000);
driver.findElement(By.xpath("//*[@id='perform']")).click();//click for download
Thread.sleep(20000);
//code to be executed after download completes
Readfile fileobj=new Readfile();
String checkfile=fileobj.checkfilename();
我怎样才能让webdriver的等待,直至下载完成?
你有问题吗? –
如何让webdriver等待下载完成 – qaepk
这超出了WebDriver的功能,一旦下载开始,它就不再是浏览器操作,因此WebDriver无法如此控制它。看看这个博客文章,这是非常丰富的,当谈到这个话题。 http://ardesco.lazerycode.com/index.php/2012/07/how-to-download-files-with-selenium-and-why-you-shouldnt/ –