[英]WebDriverError error: Chrome failed to start: exited abnormally
I'm trying to run protractor test on ubuntu 14.04 vm (by google cloud), for some reason when i run 'protractor conf.js' i get an error says: 我正试图在ubuntu 14.04 vm上运行量角器测试(通过谷歌云),出于某种原因,当我运行'protractor conf.js'时,我得到一个错误说:
E/launcher - WebDriverError: unknown error: Chrome failed to start: exited abnormally E / launcher - WebDriverError:未知错误:Chrome无法启动:异常退出
I followed this tasks in order to install headless chrome: https://gist.github.com/alonisser/11192482 我按照这个任务来安装无头镀铬: https : //gist.github.com/alonisser/11192482
Before running protractor cons.js, i'm running "webdriver-manager start" 在运行量角器cons.js之前,我正在运行“webdriver-manager start”
When i run 'Xvfb -ac :2 -screen 0 1280x1024x16' its freeze when gets to 'Initializing built-in extension GLX' 当我运行'Xvfb -ac:2 -screen 0 1280x1024x16'时,它会在“初始化内置扩展GLX”时冻结
I also tried change the conf.js to chromeOptions: { args: [ "--headless", "--disable-gpu", "--window-size=800x600" ]' but and protractor print 'start' then error: 'Failed: unknown error: an X display is required for keycode conversions, consider using Xvfb' 我也尝试将conf.js更改为chromeOptions:{args:[“ - headless”,“ - disable-gpu”,“ - window-size = 800x600”]'但是,量角器打印'开始'然后错误: '失败:未知错误:键码转换需要X显示,请考虑使用Xvfb'
It's important to mention that it's all worked great, before a couple hours. 值得一提的是,在几个小时之前,这一切都很有效。 then i just let my mac sleep, and of course it was exit the vm.. 然后我只是让我的mac睡觉,当然它是退出vm ..
I'm running the same tests with protractor in my mac and its works great. 我在mac中使用量角器进行相同的测试,效果很好。 the problem is related to chrome/chromeDriver on the instance vm. 问题与实例vm上的chrome / chromeDriver有关。
thanks a lot!!! 非常感谢!!!
I had a similar problem when using selenium + python 2.7 + chromedriver in a AWS EC2 machine. 在AWS EC2机器中使用selenium + python 2.7 + chromedriver时遇到了类似的问题。
In my case I was using the newest headless feature, so adding ' no-sandbox ' parameter to the ChromeOptions object did the trick. 就我而言,我使用的是最新的无头功能,因此在ChromeOptions对象中添加' no-sandbox '参数就可以了。
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument('headless')
chrome_options.add_argument('no-sandbox')
driver = webdriver.Chrome(chrome_options=chrome_options)
The problem seems to be a permission issue with chrome. 问题似乎是chrome的权限问题。 It does not allow a 'root' user to execute it without the --no-sandbox flag 如果没有--no-sandbox标志,它不允许'root'用户执行它
Turned out, the answer is in my question. 原来,答案在我的问题中。
You should run the command Xvfb -ac :99 -screen 0 1280x1024x16
您应该运行命令Xvfb -ac :99 -screen 0 1280x1024x16
and right after export DISPLAY=:99
export DISPLAY=:99
后立即export DISPLAY=:99
I also add to my start.sh script the command export DISPLAY=:99
The order seems to be important. 我还在start.sh脚本中添加命令export DISPLAY=:99
顺序似乎很重要。 You can ignore the error of the GLX when running the Xvfb, it can work without it. 您可以在运行Xvfb时忽略GLX的错误,它可以在没有它的情况下工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.