selenium打开chrome浏览器无痕模式
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浏览器无痕模式相关推荐
- python使用selenium打开chrome浏览器时带用户登录信息
导读 我们在使用selenium打开google浏览器的时候,默认打开的是一个新的浏览器窗口,而且里面不带有任何的浏览器缓存信息.当我们想要爬取某个网站信息或者做某些操作的时候就需要自己再去模拟登陆 ...
- [Mac] selenium打开Chrome浏览器
在Mac电脑用python+selenium打开Chrome还遇到几个问题,这里总结下,以防忘记,也可帮到别人. 前提:已安装好python3,selenium 安装chromedriver 1.先查 ...
- python调用不起来chrome_python调用selenium打开chrome浏览器失败
问 题 如题,代码如下: import socket socket.setdefaulttimeout(20) chromepath = os.path.abspath(r"C:\Progr ...
- selenium打开chrome浏览器闪退(进程结束后关闭浏览器)解决方法
from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Optio ...
- selenium打开chrome浏览器代码
import os from selenium import webdriverchromedriver = "C:\Program Files (x86)\Google\Chrome\Ap ...
- selenium如何接管(控制)已打开Chrome浏览器
一.目标 使用selenium接管已经打开的Chrome浏览器,并以百度网站为例,输出"百度一下"标签元素. 注:我的终端是windows系统,适用于windows系统 二.实现步 ...
- java中selenium设置chrome浏览器为开发者模式与IP代理
java中selenium设置chrome浏览器为开发者模式与IP代理 前言 代码 前言 之前为公司写了个爬虫项目,有时候为了绕过网站的反爬机制需要用到ip代理以及设置浏览器为开发者模式,看了一些se ...
- 说说谷歌Chrome浏览器无痕浏览器窗口
当您启用无痕浏览后,设备的其他用户将不会看到您的历史记录. Chrome 不会保存您的浏览记录或您在表单中填写的信息.当您浏览时,Chrome 会记住相应的 Cookie 和网站数据,但当您退出无痕模 ...
- 运行浏览器无痕模式报错
运行浏览器无痕模式报错:DeprecationWarning: use options instead of chrome_options 中文翻译为:用options替代chrome_options ...
最新文章
- java线程挂起唤醒_JAVA并发(10)—interrupt唤醒挂起线程
- 【LTE】LTEMIMO系统的MATLAB仿真
- 汇编指令:ldr和str,ldm和stm的区别
- 15行用Python实现仿百度搜索引擎
- SpringBoot 中添加jsp支持遇到的问题
- activemq中怎么知道推送消息是否成功_如何优雅的使用activeMQ 安装、应用、安全认证、持久化...
- 阿里开源大规模分布式图学习框架:专为Graph嵌入,无缝对接TF/PyTorch
- 2012-01-17-05
- Linux Shell 函数返回值
- IIS(IISReset.exe)命令行(备忘)
- redis数据类型-字符串
- 1 什么是机器学习(Machine Learning)?
- 收货地址列表html,收货地址.html
- SURF算法之Opencv代码详解
- 家庭局域网_局域网IP不止192.168 了解这些实用又安全
- 美的空气净化器H32评测:美观、实用以及更多
- pe下找不到ssd硬盘_进入pe后找不到固态硬盘怎么解决
- 启用Kerberos后,如何使用Tez UI
- python中seaborn库_[Python学习笔记(四)] Seaborn库基础学习——01
- HTML我的家乡宁夏学生网页设计作品 dreamweaver作业静态HTML网页设计模板 宁夏旅游景点网页作业制作