from selenium import webdriver
options = webdriver.ChromeOptions()
#无痕模式
options.add_argument('--incognito')
#启动chrome浏览器无痕模式
driver = webdriver.Chrome(chrome_options=options)
#打开百度
driver.get("http://www.baidu.com")

chorme webdriver下载:

webdriver与Chrome对应版本号

网址: http://chromedriver.storage.googleapis.com/index.html

win系统下载完成后把webdriver复制到将python安装目录下的\Scripts下即可

我的是C:\Users\thorne\AppData\Roaming\Python\Python310\Scripts


补充:selenium 启动Chrome 的其他常用配置参数

# 添加UA
options.add_argument('user-agent="MQQBrowser/26 Mozilla/5.0 (Linux; U; Android 2.3.7; zh-cn; MB200 Build/GRJ22; CyanogenMod-7) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1"')# 指定浏览器分辨率
options.add_argument('window-size=1920x3000') # 禁止GPU渲染
chrome_options.add_argument('--disable-gpu') # 隐藏滚动条, 应对一些特殊页面
options.add_argument('--hide-scrollbars')# 不加载图片, 提升速度
options.add_argument('blink-settings=imagesEnabled=false') # 浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败
options.add_argument('--headless') # 以最高权限运行
options.add_argument('--no-sandbox')# 手动指定使用的浏览器位置
options.binary_location = r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" # 禁用JavaScript
option.add_argument("--disable-javascript")

selenium打开chrome浏览器无痕模式相关推荐

  1. python使用selenium打开chrome浏览器时带用户登录信息

    导读 我们在使用selenium打开google浏览器的时候,默认打开的是一个新的浏览器窗口,而且里面不带有任何的浏览器缓存信息.当我们想要爬取某个网站信息或者做某些操作的时候就需要自己再去模拟登陆 ...

  2. [Mac] selenium打开Chrome浏览器

    在Mac电脑用python+selenium打开Chrome还遇到几个问题,这里总结下,以防忘记,也可帮到别人. 前提:已安装好python3,selenium 安装chromedriver 1.先查 ...

  3. python调用不起来chrome_python调用selenium打开chrome浏览器失败

    问 题 如题,代码如下: import socket socket.setdefaulttimeout(20) chromepath = os.path.abspath(r"C:\Progr ...

  4. selenium打开chrome浏览器闪退(进程结束后关闭浏览器)解决方法

    from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Optio ...

  5. selenium打开chrome浏览器代码

    import os from selenium import webdriverchromedriver = "C:\Program Files (x86)\Google\Chrome\Ap ...

  6. selenium如何接管(控制)已打开Chrome浏览器

    一.目标 使用selenium接管已经打开的Chrome浏览器,并以百度网站为例,输出"百度一下"标签元素. 注:我的终端是windows系统,适用于windows系统 二.实现步 ...

  7. java中selenium设置chrome浏览器为开发者模式与IP代理

    java中selenium设置chrome浏览器为开发者模式与IP代理 前言 代码 前言 之前为公司写了个爬虫项目,有时候为了绕过网站的反爬机制需要用到ip代理以及设置浏览器为开发者模式,看了一些se ...

  8. 说说谷歌Chrome浏览器无痕浏览器窗口

    当您启用无痕浏览后,设备的其他用户将不会看到您的历史记录. Chrome 不会保存您的浏览记录或您在表单中填写的信息.当您浏览时,Chrome 会记住相应的 Cookie 和网站数据,但当您退出无痕模 ...

  9. 运行浏览器无痕模式报错

    运行浏览器无痕模式报错:DeprecationWarning: use options instead of chrome_options 中文翻译为:用options替代chrome_options ...

最新文章

  1. java线程挂起唤醒_JAVA并发(10)—interrupt唤醒挂起线程
  2. 【LTE】LTEMIMO系统的MATLAB仿真
  3. 汇编指令:ldr和str,ldm和stm的区别
  4. 15行用Python实现仿百度搜索引擎
  5. SpringBoot 中添加jsp支持遇到的问题
  6. activemq中怎么知道推送消息是否成功_如何优雅的使用activeMQ 安装、应用、安全认证、持久化...
  7. 阿里开源大规模分布式图学习框架:专为Graph嵌入,无缝对接TF/PyTorch
  8. 2012-01-17-05
  9. Linux Shell 函数返回值
  10. IIS(IISReset.exe)命令行(备忘)
  11. redis数据类型-字符串
  12. 1 什么是机器学习(Machine Learning)?
  13. 收货地址列表html,收货地址.html
  14. SURF算法之Opencv代码详解
  15. 家庭局域网_局域网IP不止192.168 了解这些实用又安全
  16. 美的空气净化器H32评测:美观、实用以及更多
  17. pe下找不到ssd硬盘_进入pe后找不到固态硬盘怎么解决
  18. 启用Kerberos后,如何使用Tez UI
  19. python中seaborn库_[Python学习笔记(四)] Seaborn库基础学习——01
  20. HTML我的家乡宁夏学生网页设计作品 dreamweaver作业静态HTML网页设计模板 宁夏旅游景点网页作业制作

热门文章

  1. 剖析环境加密与文档加密
  2. 归一化相关 matlab,matlab – 归一化互相关的基础知识
  3. python:使用unquote对url解码
  4. 【NLP入门教程】五、命名实体识别
  5. RabbitMQ的简单应用
  6. 轩辕剑--资料集(五)
  7. 如何将试卷导入到mysql中,一种基于C#中将Word试题导入数据库实现方法.doc
  8. CSS—— grid 网格布局
  9. 去外包公司的伙伴们小心了!——亲身经历,数数外包公司的坑
  10. 黑群晖使用pc端 Drive