且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Selenium与Python和PhantomJS将文件下载到文件系统

更新时间:2023-01-14 08:23:28

PhantomJS目前不支持文件下载。解决方法的相关问题:

PhantomJS doesn't currently support file downloads. Relevant issues with workarounds:

  • File download
  • How to handle file save dialog box using Selenium webdriver and PhantomJS?

据我所知,至少3个选项:

As far as I understand, you have at least 3 options:


  • 切换到 casperjs (你应该在这里离开python) / li>
  • 尝试在 xvfb

  • 切换到正常的无头浏览器

  • switch to casperjs (and you should leave python here)
  • try with headless on xvfb
  • switch to normal non-headless browsers

这里也有一些可能有帮助的链接:

Here are also some links that might help too:

  • Selenium Headless Automated Testing in Ubuntu
  • XWindows for Headless Selenium (with further links inside)
  • How to run browsers(chrome, IE and firefox) in headless mode?
  • Tutorial: How to use Headless Firefox for Scraping in Linux