无头浏览器可以减少对电脑资源的消耗: #1无头浏览器phantomjs # dc = { # 'phantomjs.page.customHeaders.User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36' # } # browser = webdriver.PhantomJS(executable_path=r'F:\MyDatas\phantomjs.exe',desired_capabilities=dc) #2无头谷歌浏览器 chrome_options = Options() chrome_options.add_argument('--headless') chrome_options.add_argument('--disable-gpu') browser = webdriver.Chrome(chrome_options=chrome_options)
python3中构造无头浏览器
最新推荐文章于 2024-08-05 16:21:44 发布