selenium WebDriverException: Message: unknown error: DevToolsActivePort file doesnt exist
在centos中使用无头chrome报以下错误
selenium.common.exceptions.WebDriverException: Message: unknown error: DevToolsActivePort file doesn't exist
解决办法
禁用sandbox
- from selenium.webdriver.chrome.options import Options
from selenium import webdriver
chrome_options = Options()
#加上下面两行,解决报错
chrome_options.add_argument('--no-sandbox')
chrome_options.add_argument('--disable-dev-shm-usage')
- chrome_options.add_argument('window-size=1920x3000') #指定浏览器分辨率
chrome_options.add_argument('--disable-gpu') #谷歌文档提到需要加上这个属性来规避bug
chrome_options.add_argument('--hide-scrollbars') #隐藏滚动条, 应对一些特殊页面
chrome_options.add_argument('blink-settings=imagesEnabled=false') #不加载图片, 提升速度
chrome_options.add_argument('--headless') #浏览器不提供可视化页面. linux下如果系统不支持可视化不加这条会启动失败
# chrome_options.binary_location = r"C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" #手动指定使用的浏览器位置- driver=webdriver.Chrome(chrome_options=chrome_options)#executable_path驱动路径
driver.get('http://www.baidu.com')
print(driver.page_source)
成功运行chromedriver
selenium WebDriverException: Message: unknown error: DevToolsActivePort file doesnt exist的更多相关文章
- 解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist
解决centos7下 selenium报错--unknown error: DevToolsActivePort file doesn't exist 早上在linux下用selenium启动Chro ...
- selenium.common.exceptions.WebDriverException: Message: unknown Error: cannot find Chrome binary
使用Chrome浏览器时,经常会遇到以下报错:浏览器没有调用起来 selenium.common.exceptions.WebDriverException: Message: unknown Err ...
- Python3 Selenium自动化测试赋值出现:WebDriverException: Message: unknown error: call function result missing 'value'
Python3 Selenium自动化测试赋值出现:WebDriverException: Message: unknown error: call function result missing ' ...
- robotframework执行用例时,报错selenium.common.exceptions.WebDriverException: Message: unknown error: cannot get automation extension from unknown error: page could not be found: chrome-extension://aapnijgdinl
在用robotframework编写移动端测试用例(用chrome浏览器模拟手机浏览器),执行用例时, 报错selenium.common.exceptions.WebDriverException: ...
- WebDriverException: Message: unknown error: Chrome failed to start: crashed
the last answer WebDriverException: Message: unknown error: Chrome failed to start: crashed
- python unknown error: DevToolsActivePort file doesn't exist 问题解决
解决方案: from selenium.webdriver.chrome.options import Options chrome_options = Options() chrome_option ...
- 关于执行webdriver.Chrome; 报错WebDriverException: Message: unknown error: Element is not clickable at point (1085, 103)
from selenium import webdriverfrom time import sleep dr = webdriver.Chrome() dr.get("http://pj1 ...
- RF运行脚本报错:WebDriverException: Message: unknown error: call function result missing
原因:浏览器驱动与浏览器版本不对应
- 不能聚焦元素问题 WebDriverException: Message: unknown error: cannot focus element
上周碰到了 Unable to locate element,即“无法定位元素”,后靠两行代码解决: wait = ui.WebDriverWait(driver,5) wait.until(lamb ...
随机推荐
- Fresco对Listview等快速滑动时停止加载
Fresco中在listview之类的快速滑动时停止加载,滑动停止后恢复加载: 1.设置图片请求是否开启 // 暂停图片请求 public static void imagePause() { Fre ...
- 谈谈ssrf
一.ssrf,全称:Server-Side-Request-Forgery服务端请求伪造 二.我们正常发出的请求都是经过我们的浏览器,由我们自己的电脑发出的:而存在ssrf的目标网站,我们输入某个网址 ...
- VS2010 C#调用C++ DLL文件 【转】
http://www.soaspx.com/dotnet/csharp/csharp_20110406_7469.html 背景 在项目过程中,有时候你需要调用非C#编写的DLL文件,尤其在使用一些第 ...
- 算法之美--1.蒙特卡洛方法计算pi
基本思想: 利用圆与其外接正方形面积之比为pi/4的关系,通过产生大量均匀分布的二维点,计算落在单位圆和单位正方形的数量之比再乘以4便得到pi的近似值.样本点越多,计算出的数据将会越接近真识的pi(前 ...
- thinkphp5 中使用postgresql 缺少函数 table_msg
参考解决办法 在postgresql 中执行命令 插入函数 https://blog.csdn.net/sinat_35767703/article/details/76070236?utm_sour ...
- HDOJ 2829 Lawrence
四边形不等式优化DP Lawrence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- 使用jquey的css()方法改变样式,
$("#tip").css("display","none"); $("#tip").css("display ...
- 应用程序之Xib自定义Cell
效果展示 结构分析 代码实现 一.效果展示 二.结构分析 1⃣️首先我们让我们的控制器不再继承UIViewController,而是继承UITableViewController.这样就直接遵守了de ...
- SQL检索语句及过滤语句
首先推荐一款比较好用的数据库管理软件:navicat premium. 数据库中最重要的检索功能:SELECT语句 1.检索单个列:select 列名 from 表名: 2.检索多个列:select ...
- vscode Js 插件 Jshint 的配置
vscode这款编辑器让人用起来很舒服,但是刚刚入手的童鞋可能会对其插件的安装产生一些恐惧,虽然vscode提供了插件的搜索和安装,但是其中一些插件是需要一些软件或者包之类的东西做支撑的,并不是在vs ...