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 ...
随机推荐
- django发送邮件配置
配置如下,settings中配置: EMAIL_HOST = 'smtp.163.com' EMAIL_PORT = '25' EMAIL_HOST_USER = 'contact108@163.co ...
- java中String与equals,==详解
首先,String str1="abc",这个str1所指向的是常量池中的一块内存. 如果又有,String str2="abc",那么str1和str2所指向 ...
- 2016.8.19 将div设置为隐藏使用style=“display:none”
style="display:none"表示隐藏. style="display:block"表示显示. 在代码中则使用$("#id").s ...
- JAVA Eclipse 出现 load id=gralloc != hmi-id=gralloc怎么办
一般是应用程序权限导致的,在Manifest.xml文件中,targetSdkVersion设置不正确,你可以直接删掉这个信息
- 线程安全的概念和Synchronized(读书笔记)
并行程序开发的一大关注重点就是线程安全,一般来说,程序并行化为了获取更多的执行效率,但前提是,高效率不能以牺牲正确性为代价,线程安全就是并行程序的根本和根基.volatile并不能真正保证线 ...
- show processlist 各个状态说明
执行状态分析 1.Sleep状态 通常代表资源未释放,如果是通过连接池,sleep状态应该恒定在一定数量范围内 实战范例:因前端数据输出时(特别是输出到用户终端)未及时关闭数据库连接,导致因网络连接速 ...
- 【Python数据分析】魔术命令(Magic Command)
IPython有一些特殊的命令(被称为魔术命令),他们有的为常见的任务提供便利,有的则使你能够轻松的控制IPython系统的行为 魔术命令是以百分号%为前缀的命令 常用的IPython魔术命令 命令 ...
- 【阿里云】Windows2008 FTP配置指南
云服务器默认使用Windws 2008 IIS 中自带的FTP服务器. 1.添加FTP帐号 A. 选择[服务管理器]--[配置]--[本地用户和组]--[用户]:在空白处右键选择[新用户] ...
- 基于mysql本身的主从复制
mysql的主从复制在我理解而言就是一个主数据库进行增删改操作的时候会自动将数据写入与之关联的从数据库中.这个从数据库可以是一个也可以是多个.(刚开始理解的时候觉得是同一个数据库服务下的不同的data ...
- unslider点导航不显示错误
原因是,unslider插件只添加了dots文件并没有设置样式 解决办法 .banner { position: relative; width: 100%; overflow: auto; font ...