我想检查使用 Selenide download() 方法下载文件,但捕获 FileNotFoundException 和错误“拦截 1 个响应”,尽管文件已下载。
我有按钮,点击它会下载一个 zip 文件。元素没有 href 属性。
我使用 Selenide 5.0.0,chromdriver.exe 2.43
我有以下设置
Configuration.proxyEnabled = true;
Configuration.fileDownload = FileDownloadMode.PROXY;
Run Code Online (Sandbox Code Playgroud)
以下代码调用错误
public static SelenideElement actionButton() {return $(By.xpath("//div[@class='task-list_container_scroll-view']/div[1]/div[@class='ng-star-inserted'][1]//common-task-view//span[@role='button']"));}
File file = actionButton().download(10000);
Run Code Online (Sandbox Code Playgroud)
java.io.FileNotFoundException: 无法下载文件 {By.xpath: //div[@class='task-list_container_scroll-view']/div[1]/div[@class='ng-star-inserted'][ 1]//common-task-view//span[@role='button']} 在 10000 毫秒内。拦截了 1 个响应。200"" {Server=nginx/1.13.12, Cache-Control=private, Access-Control-Allow-Origin=*, Access-Control-Allow-Methods=POST, GET, OPTIONS, DELETE, PUT, Connection=keep-活着,到期=星期四,1970 年 1 月 1 日 00:00:00 GMT,Access-Control-Max-Age=3600,X-Application-Context="frontend":staging:80,Content-Length=1271853,Date=Wed, 2018 年 10 月 31 日 12:41:32 GMT,Access-Control-Allow-Headers=Content-Type,x-requested-with,X-Custom-Header,accept,authorization} application/octet-stream(1202830 字节)在 com。 codeborne.selenide.impl.DownloadFileWithProxyServer。