在ChromeDriver下载页面(https://chromedriver.chromium.org/downloads)上,它列出了“支持在无头模式下保存文件下载”作为ChromeDriver支持chrome77的一项功能。在
我安装了chrome77(https://www.google.com/chrome/beta/)并下载了新的ChromeDriver。我用的是Mac和Mojave 10.14.5。在
但是,当我处于无头模式时,下载不会被保存。如果不使用headless模式,文件将按预期保存。在
根据我的日志记录,我成功地点击了“下载”,就像在非无头模式下:
Element found with locator: //button[contains(text(), 'Download All as CSV')] and locator type: xpath
Clicked on element with locator: //button[contains(text(), 'Download All as CSV')] locatorType: xpath
但什么都不会下载。没有错误或异常。在
在更新Chrome/ChromeDriver之前和之后,我尝试过实现各种各样的解决方案,包括这个https://github.com/shawnbutton/PythonHeadlessChrome/blob/master/driver_builder.py,但没有任何运气。在
我所有其他的测试在无头模式下都能正常工作,只是不能下载。在
我想知道是否有其他人在新ChromeDriver上取得了成功,或者是否有人有其他的策略供我尝试-也许我可以添加进一步的日志/调试来查明问题所在?在
目前没有回答
相关问题 更多 >
编程相关推荐