Ask the expert to take a look at the cookie problem under python selenium.

-sharpcoding=utf-8
from selenium import webdriver
import time
req_url = "http://www.baidu.com/"
browser = webdriver.Chrome()
browser.get(req_url)
browser.delete_all_cookies()
cookie=[] -sharp browser.get_cookies()cookie
for t in cookie:
    browser.add_cookie(t)
browser.refresh()

because there are a number of Baidu accounts and accounts whose cookie used to use the program to simulate entering the account password to log in, but recently, these accounts all need mobile phone verification to continue to log in, but it is found that it is not necessary to log in with cookie, but it is not successful to log in with python+selenium.
the above code is for me to use my own account password that does not require verification. Previously, I successfully used selenium to enter the account password to log in to Baidu. Then browser.get_cookies () out of the cookie through add_cookie to request Baidu to show that the login is successful, but after clicking on the personal Center, or not logged in status, ask for advice to see what the problem is in the end!


using your method, run it directly and log in automatically

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3082c-2bd02.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3082c-2bd02.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?