How to download a file with Python, Selenium and PhantomJS

后端 未结 4 601
无人及你
无人及你 2021-01-06 12:31

Here is my situation: I have to login to a Website and download a CSV from there, headless from a linux server. The page uses JS and does not work without it.

After

4条回答
  •  悲&欢浪女
    2021-01-06 13:19

    If the button that you want to download has the file link, you are able to test downloading it using python code, because PhantonJs does not support a download by itself. So, if your download button does not provide the file link, you're not able to test.

    To test using file link and phyton (to assert that file exists), you can follow this topic. As I'm a C# developer and testes, I don't know the better way to write the code in python without errors, but Im sure you can:

    Basic http file downloading and saving to disk in python?

提交回复
热议问题