2019-05-07--重学Python21--知乎大神方法也不灵啊!还得继续研究

1,我先获取了自己登陆状态下的cookie。然后注入进去,发现还是不行啊!


from selenium import webdriver
import time

driver_path = "D:\chromedriver_win32\chromedriver.exe"
driver = webdriver.Chrome(executable_path=driver_path)

cookie_list = [{'domain': 'www.ketangpai.com', 'httpOnly': False, 'name': 'PHPSESSID', 'path': '/', 'secure': False, 'value': 'qr5j3bf82km15f5fnt5adfhrn4'}, {'domain': 'www.ketangpai.com', 'expiry': 1557227707.300883, 'httpOnly': False, 'name': 'ketangpai_home_remember', 'path': '/', 'secure': False, 'value': 'think%3A%7B%22username%22%3A%22MDAwMDAwMDAwMLOGud2GqauyhKiclLHPkZ4%22%2C%22expire%22%3A%22MDAwMDAwMDAwMLOGuZWH36-whc6KlbG2dZ4%22%2C%22token%22%3A%22MDAwMDAwMDAwMMurrpWavLehhs1-3rKpfZKFt4uVepuomcWmmqaMiHtnr5ylzYWosKKZq6HQxtOK0ZCme5p-q6iZu2yrn4uNhJ3KedDYk7ivboS4ipWy34HZhM2HlX6KYW0%22%7D'}, {'domain': 'www.ketangpai.com', 'httpOnly': False, 'name': 'SERVERID', 'path': '/', 'secure': False, 'value': '05392fafbe3a7b293d97229ac870b47f|1557216553|1557216543'}]


driver.get("https://www.ketangpai.com/Home/User/login.html")
driver.delete_all_cookies()
time.sleep(3)

# t1 = driver.get_cookies()
# print(t1)

for cookie in cookie_list:
    driver.add_cookie(cookie)

driver.refresh()
# driver.get("https://www.ketangpai.com/Main/index.html")

你可能感兴趣的:(2019-05-07--重学Python21--知乎大神方法也不灵啊!还得继续研究)