我有一个服务,它使用selenium启动一个使用chrome无头模式的chrome webdriver。该应用程序通过tomcat8启动。我可以在我的mac电脑上运行这项服务而不会出现问题。
但是,一旦我通过AWS Elastic Beanstek
将其部署到ec2节点,Web驱动程序就无法正常启动:
28-Feb-2019 03:32:48.944 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [registerCustomer] in context with path [] threw exception
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'ip-172-31-16-234', ip: '172.31.16.234', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.97-74.72.amzn1.x86_64', java.version: '1.8.0_191'
Driver info: driver.version: ChromeDriver
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:192)
at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:178)
at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:601)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:219)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:142)
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 com.christina.insbot.factory.BrowserDriverFactory.createWebDriver(BrowserDriverFactory.java:64)
at com.christina.insbot.service.InsBot.<init>(InsBot.java:86)
at com.christina.insbot.service.servlet.RegisterCustomerService.doPost(RegisterCustomerService.java:93)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)
at org.apache.catalina.valves.RemoteIpValve.invoke(RemoteIpValve.java:685)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:650)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:13611/status] to be available after 20010 ms
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:187)
... 36 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:147)
at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
... 37 more
CATALINA错误:
/var/lib/tomcat8/webapps/ROOT/webdriver/chromedriver: /var/lib/tomcat8/webapps/ROOT/webdriver/chromedriver: cannot execute binary file
28-Feb-2019 03:32:48.926 SEVERE [Forwarding newSession on session null to remote] org.openqa.selenium.os.OsProcess.checkForError org.apache.commons.exec.ExecuteException: Process exited with an error: 126 (Exit value: 126)
我启动网络驱动程序的方式是这样的:
ChromeOptions options = new ChromeOptions();
// "--headless",
options.addArguments("--disable-gpu", "--window-size=1920,1200",
"--ignore-certificate-errors", "--silent");
if (useHeadlessMode) {
options.addArguments("--headless");
}
System.setProperty("webdriver.chrome.driver", EnvironmentInitialization.obtainChromeDriverPath());
webDriver = new ChromeDriver(options);
此错误消息。。。
28-Feb-2019 03:32:48.944 SEVERE [http-nio-8080-exec-7] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [registerCustomer] in context with path [] threw exception
org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: '3.8.1', revision: '6e95a6684b', time: '2017-12-01T18:33:54.468Z'
System info: host: 'ip-172-31-16-234', ip: '172.31.16.234', os.name: 'Linux', os.arch: 'amd64', os.version: '4.14.97-74.72.amzn1.x86_64', java.version: '1.8.0_191'
Driver info: driver.version: ChromeDriver
…意味着您的程序无法在无头模式下启动/生成新的ChromeDriver服务。
此外,此错误消息。。。
/var/lib/tomcat8/webapps/ROOT/webdriver/chromedriver: /var/lib/tomcat8/webapps/ROOT/webdriver/chromedriver: cannot execute binary file
28-Feb-2019 03:32:48.926 SEVERE [Forwarding newSession on session null to remote] org.openqa.selenium.os.OsProcess.checkForError org.apache.commons.exec.ExecuteException: Process exited with an error: 126 (Exit value: 126)
…意味着您的程序无法执行chromedriver二进制文件,因此将空会话转发到RemoteWebServer。
更多关于ChromeDriver和ChromeBrowser版本的信息可以帮助我们更好地调试您的问题。然而,您需要注意以下几个事实:
--disable-gpu
标志在Linux系统和MacOS上不需要。--disable-gpu
标志在Windows系统上也将变得不必要。您可以在以下网站找到相关讨论:
我正试图使用Selenium Grid启动一款新的Chrome浏览器,但最终出现以下错误 无法创建新的远程会话。所需功能=能力[{浏览器名称=chrome,版本=55.0.2,平台=WINDOWS}],所需功能=能力[{}]构建信息:版本:“3.0.1”,修订版本:“1969d75”,时间:“2016-10-18 09:49:13 -0700”系统信息:主机:“PL9710388”,ip:“10.
当我尝试运行测试时,我得到这个错误。 sessionNotCreatedException:无法创建新的远程会话。所需功能=功能[{PlatformName=Android,DeviceName=F4AZFG07P508}],所需功能=功能[{}]生成信息:版本:“3.3.1”,修订版:“5234B325D5”,时间:“2017-03-10 09:10:29+0000”系统信息:主机:“MacBo
问题内容: 我正在尝试从集线器到节点运行一个简单的代码,集线器和节点连接成功。 执行程序时出现异常 我提到的Chrome驱动程序路径是可以从节点计算机访问的共享路径。 Chrome版本:58.0.3029.110 Chrome驱动程序版本:2.9 集线器和节点都是远程计算机。 下面是使用的代码: 下面是控制台消息: 问题答案: 这是您问题的答案: 当您使用以下命令启动 Selenium Grid
我在所有浏览器中都遇到了这个例外。例如,我在chrome上创建了一个远程webdriver,如下所示: 我得到了UnreachableBrowserException如下: 但我在<代码>http://myIP:4444/grid/console,一切正常,节点仍然注册。然后在<代码>http://myIP:5555/wd/hub/static/resource/hub.html,我仍然可以单击“
null 我的脚本中使用的代码: 详细的堆栈跟踪: an 19,2017 6:07:36 PM org.openqa.selenium.remote.ProtocolHandshake创建session信息:尝试双方言会话,假设Postel定律在远程端成立,Jan 19,2017 6:07:37 PM org.openqa.selenium.remote.ProtocolHandshake创建se
我最近安装了一个用于开发测试的selenium网格环境。然而,我们面临以下错误: 转发新会话时出错,无法找到:功能{browserName:chrome,chromeOptions:{args:[--headless,--no sandbox],二进制:,首选项:{plugins.always\u open\u pdf\u externally:true},w3c:false},loggingPr