tl;博士:我想做Python 2.7 - Selenium headless testing with Xvfb not working<这个人做的事,但在Windows上。
不可协商:导航允许下载文件的无头webdriver。
从阅读其他答案看,xvfb似乎不适用于Windows,因此PyVirtualDisplay无法与Chrome一起使用:easyprocess.EasyProcessCheckInstalledError: cmd=['Xvfb', '-help'] OSError=[Errno 2] No such file or directory
似乎需要很多疯狂的黑客来让PhantomJS下载文件。
有些答案建议使用urrlib或HTTPrequest:
Basic http file downloading and saving to disk in python?
How to download a file with Python, Selenium and PhantomJS
...除非要访问我想要下载的文件,否则我必须登录并使用Selenium进行一系列Xpath导航。
有更简单的方法吗? (希望自从之前的相关帖子以来有新的东西)