Skip to content

Instantly share code, notes, and snippets.

@billju
Created June 12, 2019 11:54
Show Gist options
  • Save billju/7616727b199dcf1e9edbae3b84d4359b to your computer and use it in GitHub Desktop.
Save billju/7616727b199dcf1e9edbae3b84d4359b to your computer and use it in GitHub Desktop.
from selenium import webdriver
driver = webdriver.Chrome('C:/Users/使用者名稱/Downloads/chromedriver.exe')
driver.get('https://shopee.tw/') #會彈出新的頁面
cookies = driver.get_cookies() #格式為list包dict
csrftoken = [item['value'] for item in cookies if item['name'] == 'csrftoken'][0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment