Using Selenium with Python and PhantomJS to download file to filesystem

后端 未结 4 1814
感动是毒
感动是毒 2020-12-05 02:50

I\'ve been grappling with using PhantomJS/Selenium/python-selenium to download a file to the filesystem. I\'m able to easily navigate through the DOM and click, hover etc. D

4条回答
  •  被撕碎了的回忆
    2020-12-05 03:32

    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?

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

    • 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

提交回复
热议问题