Java org.openqa.selenium.WebDriverException:等待驱动程序服务器启动超时。构建信息:版本:“未知”,修订:“未知”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/52110521/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 00:20:23  来源:igfitidea点击:

org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: 'unknown', revision: 'unknown'

javaspringseleniumubuntuselenium-chromedriver

提问by Gianmarco F.

While everything works on my machine, when I bring the project in which I'm working on my server, Selenium and Chromedriver won't boot, causing the following exception

虽然我的机器上一切正常,但当我在我的服务器上运行项目时,Selenium 和 Chromedriver 无法启动,导致以下异常

2018-08-31 09:16:06,578 ERROR [stderr] (Exec Stream Pumper) /home/app.conf/homebooks2/chromedriver: 1: /home/app.conf/homebooks2/chromedriver: Syntax error: Unterminated quoted string
2018-08-31 09:16:26,570 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /crawlerClass/myCrawler/5922: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'shaula', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'i386', os.version: '3.16.0-44-generic', java.version: '1.8.0_92'
Driver info: driver.version: ChromeDriver
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
    at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:129)
    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:317)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:127)
    at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:91)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:114)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:137)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:111)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:170)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:63)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:200)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:116)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:64)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:56)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at it.myproject.security.web.utils.AjaxConcurrentSessionFilter.doFilter(AjaxConcurrentSessionFilter.java:70)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:105)
    at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:331)
    at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:214)
    at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    at org.springframework.security.web.debug.DebugFilter.invokeWithWrappedRequest(DebugFilter.java:90)
    at org.springframework.security.web.debug.DebugFilter.doFilter(DebugFilter.java:77)
    at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:262)
    at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61)
    at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131)
    at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84)
    at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)
    at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)
    at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131)
    at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46)
    at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64)
    at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60)
    at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77)
    at io.undertow.security.handlers.NotificationReceiverHandler.handleRequest(NotificationReceiverHandler.java:50)
    at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292)
    at io.undertow.servlet.handlers.ServletInitialHandler.access0(ServletInitialHandler.java:81)
    at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:138)
    at io.undertow.servlet.handlers.ServletInitialHandler.call(ServletInitialHandler.java:135)
    at io.undertow.servlet.core.ServletRequestContextThreadSetupAction.call(ServletRequestContextThreadSetupAction.java:48)
    at io.undertow.servlet.core.ContextClassLoaderSetupAction.call(ContextClassLoaderSetupAction.java:43)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.api.LegacyThreadSetupActionWrapper.call(LegacyThreadSetupActionWrapper.java:44)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272)
    at io.undertow.servlet.handlers.ServletInitialHandler.access
[...]
public Map initCrawler(Things that I give as input) throws InterruptedException, ApiException, IOException {
    System.setProperty("webdriver.chrome.driver",  BackEndProperties.getProperty("chrome_driver_path") );
    final ChromeOptions chromeOptions = new ChromeOptions();
    //chromeOptions.setBinary("/usr/bin/chromium-browser"); 
    chromeOptions.addArguments("--headless");
    chromeOptions.addArguments("--disable-extensions");
    chromeOptions.addArguments("--disable-gpu");
    chromeOptions.addArguments("--no-sandbox");
    [...]
0(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202) at io.undertow.server.HttpServerExchange.run(HttpServerExchange.java:805) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start. Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'shaula', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'i386', os.version: '3.16.0-44-generic', java.version: '1.8.0_92' Driver info: driver.version: ChromeDriver at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:193) at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:179) at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79) at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548) at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:212) at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:130) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:168) at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:157) at it.myproject.initCrawler(ImmobiliareItController.java:127) at it.myproject$$FastClassBySpringCGLIB$$c2524ba.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:721) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:52) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:656) at it.myproject$$EnhancerBySpringCGLIB$$a6350cf3.initCrawler(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ... 84 more Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:4668/status] to be available after 20000 ms at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100) at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:188) ... 116 more Caused by: java.util.concurrent.TimeoutException at java.util.concurrent.FutureTask.get(FutureTask.java:205) at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156) at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75) ... 117 more

Everything works like this: the user, for launching the crawler, is supposed to click a button. Then, with JavaScript, I make an Ajax call to a specific method of a specific class that holds my crawler for the initialization, which is as it follows

一切都是这样的:用户为了启动爬虫,应该点击一个按钮。然后,使用 JavaScript,我对特定类的特定方法进行 Ajax 调用,该类包含我的爬虫以进行初始化,如下所示

2018-08-31 09:16:26,570 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /crawlerClass/myCrawler/5922: org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.

As I said, everything works fine on my machine but not on server side. Searching the web helped me understanding that whoever had this problem fixed it just by upgrading the old instance of chromium on the server and that's what I did (and I also downloaded the latest ChromeDriver available) but that didn't solve anything. I was also thinking in trying another browser for seeing if it might change something. Does anybody have some clues with which I might work?

正如我所说,在我的机器上一切正常,但在服务器端却没有。搜索网络帮助我了解遇到这个问题的人只是通过升级服务器上的旧铬实例来解决它,这就是我所做的(并且我还下载了最新的 ChromeDriver 可用)但这并没有解决任何问题。我也在考虑尝试另一个浏览器,看看它是否会改变一些东西。有没有人有一些我可以工作的线索?

采纳答案by DebanjanB

This error message...

这个错误信息...

System.setProperty("webdriver.chrome.driver", DriverFactory.getChromeDriverPath())
System.setProperty("webdriver.chrome.logfile", "${System.getenv('HOME')}/Documents")

...implies that the ChromeDriverwas unable to initiate/spawn a new WebBrowseri.e. Chrome Browsersession.

...暗示ChromeDriver无法启动/生成新的WebBrowser,Chrome 浏览器会话。

Your base exceptionis the org.openqa.selenium.WebDriverExceptionas your program Timed out waiting for driver server to startbecause of the following reason:

您的基本异常org.openqa.selenium.WebDriverException因为您的程序超时等待驱动程序服务器启动,原因如下:

  • Your JDK versionis 1.8.0_92which is pretty ancient.
  • 您的JDK 版本1.8.0_92,这是非常古老的

So there is a clear mismatch between the JDK v8u92and current Selenium Client v3.14.0.

因此,JDK v8u92和当前的Selenium Client v3.14.0之间存在明显的不匹配。

Solution

解决方案

回答by Vaibs

Just a less probable scenario where the similar error is thrown is a silly human mistake.

抛出类似错误的可能性较小的情况是愚蠢的人为错误。

For all using phantomjs WebDriver and facing this error must check if they are actually giving the right path to the phantomjs.exe . This error will be thrown when given the path to Chromedriver and instantiating the PhantomJs driver

对于所有使用 phantomjs WebDriver 并面临此错误的人,必须检查他们是否确实提供了 phantomjs.exe 的正确路径。当给定 Chromedriver 的路径并实例化 PhantomJs 驱动程序时,将抛出此错误

回答by Mate Mr?e

I had this error when creating the chromedriver after trying to get the log being written to file:

在尝试将日志写入文件后创建 chromedriver 时出现此错误:

WebDriver driver1 = new ChromeDriver()

The error would appear at this line:

错误将出现在这一行:

System.setProperty("webdriver.chrome.logfile", "${System.getenv('HOME')}/Documents/chromedriver.log")

but I forgot to add the filename. After doing the following, everything was back to normal:

但我忘了添加文件名。执行以下操作后,一切恢复正常:

System.setProperty("webdriver.chrome.driver", "C:\Users\<username>\Downloads\chromedriver_win32\chromedriver.exe");

回答by YumeNoShizuku

There is one more aspect of the version mismatch between JDK and Selenium: sometimes the JDK minor version might be too high(e.g., JDK 8u201 and Selenium 3.141.59 doesn't seem to be compatible, but 8u192 works). You may need to downgrade the JDK minor version to the one that was released beforethe release date of the version of Selenium you are using.

JDK 和 Selenium 之间的版本不匹配还有一个方面:有时 JDK 次要版本可能太高(例如,JDK 8u201 和 Selenium 3.141.59 似乎不兼容,但 8u192 有效)。您可能需要将 JDK 次要版本降级到您正在使用的 Selenium 版本发布日期之前发布的版本。

回答by Karuna

This error got resolved for me when I copied 'chromedriver.exe' file path instead of chrome.exe. I hope someone gets helped with it

当我复制“chromedriver.exe”文件路径而不是 chrome.exe 时,这个错误得到了解决。我希望有人得到帮助

Correct:

正确的:

System.setProperty("webdriver.chrome.driver", "C:\Users\<username>\AppData\Local\Google\Chrome\User Data\Default");

Wrong:

错误的:

##代码##

回答by Neelima Sriram

I ran into the similar error, which states: WebDriverException: Timed out waiting for driver server to start.

我遇到了类似的错误,其中指出:WebDriverException: Timed out waiting for driver server to start。

Closing the existing chrome browser instances, has resolved the issue in my case.

关闭现有的 chrome 浏览器实例,已经解决了我的问题。

I am running hub and node on the same machine (Windows10)

我在同一台机器上运行集线器和节点(Windows10)