Download CSV from url to Selenium?

I have a URL that I want to download regularly. It can only be obtained from a registered account that requires JavaScript support, and therefore I have to use Selenium with PhantomJS, trust me. Otherwise, I would just use urllib for this, but it gives me an error sign.

This is a CSV file with a maximum of 1000 rows and about 6 columns.

I want this CSV to end up on the list. Does anyone know how to download CSV using Selenium Webdriver?

Many thanks.

Edit: I just want to download CSV from a URL in Selenium. Nothing else.

+4
source share
2

. ,

fooobar.com/questions/1489014/...

EDIT: Firefox

:

  • sudo apt-get install xvfb ( )
  • pip install --user xvfbwrapper

from xvfbwrapper import Xvfb

vdisplay = Xvfb()
vdisplay.start()

# launch stuff inside virtual display here

vdisplay.stop()

: Firefox-

+1

page_source?

browser.get("http://winterolympicsmedals.com/medals.csv")
csv_file = browser.page_source
print(csv_file)

, . Selenium + Python + HTMLUnit, .

, PhantomJS

+1

Source: https://habr.com/ru/post/1527584/


All Articles