selenium爬虫---不要总是弹出浏览器
2018-11-22 本文已影响4人
布口袋_天晴了
当爬虫页面很多时,不希望总是让浏览器弹出。
参考文章:在爬虫时,如何设置selenium,启动时不弹出浏览器
chrome推出了headless模式代码:
chrome_options= webdriver.ChromeOptions()
chrome_options.add_argument('--headless')
chrome_options.add_argument('--disable-gpu')
driver = webdriver.chrome(chrome_options=chrome_options)
driver.get(url)