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 ...
随机推荐
- xshell登录到CentOS7上时出现“The remote SSH server rejected X11 forwarding request.
其原因是肯能对openssh版本进行了升级. 解决方法为: yum install xorg-x11-font* xorg-x11-xauth /etc/ssh/sshd ...
- 分析cocos2d-x的lua项目中的工具方法
在创建完cocos2d-x的lua项目后.打开项目的Resources中的extern.lua文件.里面有两个用于面向对象的方法.一个是用于克隆,一个是用于继承. 代码分析例如以下 --克隆一个对象 ...
- Shell脚本之:case
case ... esac 与其他语言中的 switch ... case 语句类似,是一种多分枝选择结构. case语句的语法 case 值 in 模式1) command1 command2 co ...
- Xutils的get请求后,总是返回同样数据的问题解决方式
原因: XUtils中的HttpUtils框架採用的时,HttpUtils对于GET请求採用了LRU缓存处理.默认60秒内提交返回上次成功的结果. 解决方法: HttpUtils http = new ...
- CentOS7.1 KVM虚拟化之经常使用管理虚拟机命令(3)
一.查看虚拟机列表及状态 [root@kvm01 ~]# virsh list --all Id Name State ---------------------------------------- ...
- spring-struts-mybatis整合错误集锦
尽管三大框架特别特别的好用,可是,当我第一次把这三个框架用maven整合到一起的时候.各种错误接踵而至,以下来做一下三大框架整合的总结: 首先是在导入三大框架的各种依赖包的时候,由于我用的是j2ee ...
- DML过程中记录错误日志
当你插入几百万数据时,由于有几条脏数据而导致插入失败,是不是很恼火.10g R2之后有个新功能.将插入过程中失败的记录插入到还有一张表中. SQL> drop table test purge; ...
- 应用处理器AP概述
移动终端芯片其它部分见"一站式了解智能终端处理器". 功能机时代,扩展手机特性是在基带芯片上进行.手段包含:升级基带芯片获得更强的计算能力.电路进行又一次设计以添加功能如照相机和S ...
- 怎样给filter加入自己定义接口
.在Cfilter类的定义中实现Interface接口的函数的定义: //-----------------------Interface methods----------------------- ...
- tomcat报错: Error parsing HTTP request header
Error parsing HTTP request header 在服务器上面集成项目的时候,tomcat报错,在往上面查找是因为eclipse运行的tomcat和服务器上面的tomcat版本不一致 ...