webdriver得到cookies并应用保存
cf = configparser.ConfigParser() ac=cf.read("my.ini")
cookie = driver.get_cookies() xx=driver.get_cookie(name="zp_passport_deepknow_sessionId") xx1=driver.get_cookie(name="x-zp-client-id") xx2=driver.get_cookie(name="Hm_lpvt_38ba284938d5eddca645bb5e02a02006") xx3=driver.get_cookie(name="acw_tc") xx4=driver.get_cookie(name="at") xx5=driver.get_cookie(name="rt") print(xx['value'],xx1['value'],xx2['value'],xx3['value'],xx4['value'],xx5['value']) #cf.add_section("ssh") cf.set("ssh","cooka",xx['value']) cf.set("ssh","xid",xx1['value']) cf.set("ssh","hm",xx2['value']) cf.set("ssh","acw",xx3['value']) cf.set("ssh","at",xx4['value']) cf.set("ssh","rt",xx5['value']) cf.write(open("my.ini","w")) 读 newcook=cf.get("ssh","cooka") xid=cf.get("ssh","xid") hm=cf.get("ssh","hm") acw=cf.get("ssh","acw") at=cf.get("ssh","at") rt=cf.get("ssh","rt")