Watir-Webdriver 等待下载完成 [英] Watir-Webdriver Wait for Download to Complete
问题描述
我正在将 Watir-Webdriver 与 Firefox 一起使用,并使用 watirwebdriver.com 网站上推荐的方法来自动下载文件.这涉及设置 FireFox about:config 参数以禁用 FireFox 中特定文件类型的下载对话框.这很有效,但现在我想弄清楚如何最好地确定文件下载何时完成(有些需要几秒钟,有些需要几分钟),以便我可以注销该站点并继续进行下一个测试.似乎因为浏览器中没有留下任何视觉线索,我可能不得不监视下载目录中的文件.任何选择将不胜感激.
I am using Watir-Webdriver with Firefox and the method recommended on the watirwebdriver.com site to automate file downloads. This involves setting FireFox about:config parameters to disable the download dialog in FireFox for specific file types. This works well but now I am trying to figure out how best to determine when the file download has completed (some take a few seconds, some take minutes) so I can logout of the site and move on to the next test. It seems since there are no visual clues left in the browser I may have to monitor the file in the download directory. Any options would be appreciated.
推荐答案
Chrome 使用添加的 .crdownload
文件扩展名存储未完成的下载.检查下载目录是否有一个以 .crdownload
结尾的文件,这应该告诉你下载是否仍在进行中
Chrome stores uncompleted downloads with an added .crdownload
file extension. Check to see if the download directory has a file ending with .crdownload
and that should tell you if a download is still ongoing
这篇关于Watir-Webdriver 等待下载完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!