赞
踩
selenium获取cookie,忘记从哪儿转载的了,留一下做个备份
# -*- coding: utf-8 -*- from selenium import webdriver import time import json from selenium.webdriver.support import expected_conditions as EC from selenium.webdriver.support.wait import WebDriverWait from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By def browser_initial(): """" 进行浏览器初始化 """ log_url = 'https://wx.xxx.com//tiku/exam/item/405592?papertype=2' chrome_options = Options() # chrome_options.add_argument('--headless') # 设置无界面 chrome_options.add_argument('disable-infobars') user_agent = ( "User-Agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36'") chrome_options.add_argument('user-agent=%s' % user_agent) browser = webdriver.Chrome(chrome_options
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。