Selenium
Table of Contents
Overview
- Install chromedriver with
brew install chromedriver
from selenium import webdriver
driver = webdriver.Chrome('chromedriver')
driver.get('https://google.com')
print(driver.page_source)
How-to
Set cookies
# Go to the correct domain
driver.get("http://www.example.com")
# Now set the cookie. This one's valid for the entire domain
cookie = {'name': 'foo', 'value': 'bar'}
driver.add_cookie(cookie)
# And now output all the available cookies for the current URL
driver.get_cookies()