美文网首页python爬虫攻防
selenium爬虫---不要总是弹出浏览器

selenium爬虫---不要总是弹出浏览器

作者: 布口袋_天晴了 | 来源:发表于2018-11-22 11:58 被阅读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)

    相关文章

      网友评论

        本文标题:selenium爬虫---不要总是弹出浏览器

        本文链接:https://www.haomeiwen.com/subject/emflqqtx.html