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 ...
随机推荐
- 比JSONKit还要快的第三方JSON解析器NextiveJson
这款比JSONKit还好用,效率跟iOS5原生的差不多,不过解析后对内存的释放比原生的要多.所以推荐 https://github.com/nextive/NextiveJson 顺便提一下解析XML ...
- 【div+css】两个div,如何让内层的div在外层div中水平垂直居中
好久没有写样式,很是很生疏 ==================================================================== 方法1: .parent { wi ...
- TensorFlow笔记一 :测试和TFboard使用
一 .第一个TF python3.6 import tensorflow as tf x=2 y=3 node1=tf.add(x,y,name='node1') node2=tf.multiply ...
- oracle12安装软件后安装数据库,然后需要自己配置监听
oracle12安装软件后安装数据库,然后需要自己配置监听 没想到你是这样的oracle12: 不能同时安装软件和数据库,分别安装之后,\NETWORD\ADMIN\下面竟然没有listener.or ...
- [Django]中建立数据库视图
Django中建立数据库视图 Django中没有建立视图的接口.假设要建立一个视图须要一些手动的改变. 这里使用的Django 版本号>1.5, 使用的数据库为mysql 第一步 建立视图,比如 ...
- poj1649 Rescue(BFS+优先队列)
Rescue Time Limit: 2 Seconds Memory Limit: 65536 KB Angel was caught by the MOLIGPY! He was put ...
- spring 官方文档
英文 http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/ 翻译(1-6章) http:// ...
- 【转载】关于 .Net 逆向的那些工具:反编译篇
在项目开发过程中,估计也有人和我遇到过同样的经历:生产环境出现了重大Bug亟需解决,而偏偏就在这时仓库中的代码却不是最新的.在这种情况下,我们不能直接在当前的代码中修改这个Bug然后发布,这会导致更严 ...
- C语言 结构体篇
结构体:是一种构造类型 它是由若干成员组成的 其中每一个成员都可以是一个基本数据类型或者又是一个构造类型 定义结构体变量后,系统就会为其自动分配内存 为了便于更大的程序便于修改和使用 常常将结构体类 ...
- cmake学习之- cmake_parse_arguments
最后更新: 2019-06-08 一.指令介绍 cmake_parse_arguments 为解析函数(function)或 宏(macros) 参数的命令: cmake_parse_argument ...