概述
未安装 sudo yum install GConf2
org.openqa.selenium.WebDriverException: unknown error: Chrome failed to start: exited abnormally
(Driver info: chromedriver=2.21.371461 (633e689b520b25f3e264a2ede6b74ccc23cb636a),platform=Linux 3.10.0-693.2.2.el7.x86_64 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 60.13 seconds
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: '*************************', ip: '*************************', os.name: 'Linux', os.arch: 'amd64', os.version: '3.10.0-693.2.2.el7.x86_64', java.version: '1.8.0_152'
Driver info: driver.version: ChromeDriver
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
at org.openqa.selenium.remote.JsonWireProtocolResponse.lambda$errorHandler$0(JsonWireProtocolResponse.java:54)
at org.openqa.selenium.remote.HandshakeResponse.lambda$getResponseFunction$0(HandshakeResponse.java:30)
at org.openqa.selenium.remote.ProtocolHandshake.lambda$createSession$0(ProtocolHandshake.java:126)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.Spliterators$ArraySpliterator.tryAdvance(Spliterators.java:958)
at java.util.stream.ReferencePipeline.forEachWithCancel(ReferencePipeline.java:126)
at java.util.stream.AbstractPipeline.copyIntoWithCancel(AbstractPipeline.java:498)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:485)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:152)
at java.util.stream.Abstra
chromedriver 与 google-chrome 版本用法说明,例:
我的服务版本是 Google Chrome 73.0.3683.103
从这个地方下的不行包有问题 http://chromedriver.storage.googleapis.com/index.html
到此处下载 :http://npm.taobao.org/mirrors/chromedriver
有版本 73.0.3683.20 和 73.0.3683.68
这两个都不是 我用了 2.46
对应的关系表可以上百度下可以找到很多
还有就是记行加入 chmod 777 chromedriver
注 Linux 下加入
ChromeOptions chromeOptions=new ChromeOptions();
if(MySystem.isLinux()) {
chromeOptions.addArguments("headless");//无界面参数
chromeOptions.addArguments("no-sandbox");//禁用沙盒 就是被这个参数搞了一天
}
补冲
1. 记得安装 google 浏览器
后来又装了一台服务器怎么搞都不成功:
我 直接下了:
wget https://chromedriver.storage.googleapis.com/2.40/chromedriver_linux64.zip
unzip chromedriver_linux64.zip
2.4的居然成功了
我认为可能是我用windows下的,所以出了问题,以后用linux 直接下直接用,再试试
chrome 7.8 以后出现执行click事件报错,更换写法
WebElement selector1 = webDriver.findElementByCssSelector("#chartsHref > div.daysChart > div.daysModel > div.daysRain > div.dayBar.day1st");
webDriver.executeScript("arguments[0].click();", selector1);
最后
以上就是友好小鸽子为你收集整理的selenium报错 error while loading shared libraries: libgconf-2.so.4: cannot open shared ob (sentos 7.4)的全部内容,希望文章能够帮你解决selenium报错 error while loading shared libraries: libgconf-2.so.4: cannot open shared ob (sentos 7.4)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复