Skip to content

Instantly share code, notes, and snippets.

@flashfoxter
Forked from blaix/selenium-download.py
Created March 19, 2019 19:40
Show Gist options
  • Save flashfoxter/672205490fd04a6d0f889c80e4dfef49 to your computer and use it in GitHub Desktop.
Save flashfoxter/672205490fd04a6d0f889c80e4dfef49 to your computer and use it in GitHub Desktop.
Download file in a selenium session that requires a cookie from that session
# http://selenium-python.readthedocs.org/en/latest/api.html?highlight=cookie#selenium.webdriver.remote.webdriver.WebDriver.get_cookie
cookie = driver.get_cookie("cookie_name")
subprocess.check_call(["curl", "--cookie", "cookie_name=%" % cookie["value"], url, "-o", "destination_filename")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment