Tofu tofu
# Log DEF login_jd (): # sign in front to clear all the cookie browser.get ( 'https://www.baidu.com/') browser.delete_all_cookies () # login before printing the cookie cookieBefore = browser.get_cookies () Print ( cookieBefore) Print ( "--------------------------------------------- --------------------------- ") the time.sleep (2) list_cookies = [ { 'Domain': '.baidu.com', 'httpOnly': False, 'name': 'H_PS_PSSID', 'path': '/', 'Secure': False, 'value': '1420_21120_29074_29237_2518_2909_29134_2832_28585_26350_2913'}, { 'Domain': '.baidu.com', ' expiry ': 159184274.325927,' httpOnly ' : False,'name': 'BAIDUID', 'path': '/', 'secure': False, 'value': 'FF789623EA1785FF0D55ED0401D057B2:FG=1'}, { 'Domain': 'www.baidu.com', 'expiry': 1563289, 'httpOnly ': False, 'name': 'BD_UPN', 'path': '/', 'secure': False, 'value': '123143'}, {'domain': '.baidu.com', 'expiry': 1560354688.892916, 'httpOnly': False, 'name': 'BDORZ', 'path': '/', 'secure': False, 'value': 'B490B5BF6F3CD40255D22BCDA1598'}, {'domain': '.baidu.com', 'expiry': 1819468287.471656, 'httpOnly': True, 'name': 'BDUSS', 'path': '/', 'secure': False, 'value': 'tGem1JzblNpOa1VVek0yLThmbWR6RxENWZtcVNwUThpT2hCLTVsUFBQUFBJCQAAAAAAAAAAAEAAAA4MdBAd3d3d2dnZ2dnZWVlZWUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAALkI~1y5CP9cVm'}, {'domain': '.baidu.com', 'expiry': 2569420288, 'httpOnly': False, 'name': 'BIDUPSID', 'path': '/', 'secure': False, 'value': '587A2695FCD6D043A5FE5139E4F'}, { 'domain': '.baidu.com' , 'expiry': 3707755.819949, 'httpOnly': False, 'name': 'PSTM', 'path': '/', 'secure': False, 'value': '156 027 786'}, { 'Domain': 'www.baidu.com', 'httpOnly': False, 'name': 'BD_HOME', 'path': '/', 'Secure': False, 'value': '. 1'} ] # 获取之后的cookie cookies = browser.get_cookies () Print (browser.get_cookies ()) # acquired all cookies added to the browser for Cookie in list_cookies: browser.add_cookie (Cookie) Print (Cookie) the time.sleep ( 2) # refresh the page to update the cookie browser.refresh () Time.sleep(505) browser.quit()