为什么我的客户端不能在非默认端口(运行 on mac)上调用 selenium 服务器?
why cannot my client call selenium server on non-default port (running on mac)?
我看到这个 post 关于如何 运行 2 个不同端口上的 selenium 网络驱动器服务器。
我试过这样做:
java -Dwebdriver.chrome.driver=./chromedrive -jar selenium-server-standalone-2.44.0.jar -port 4445
和运行 调用端口 4445 上的服务器的代码
但我得到这个例外:
rond-macpro:selenium eladb$ java -Dwebdriver.chrome.driver=./chromedrive -jar selenium-server-standalone-2.44.0.jar -port 4445
17:26:14.740 INFO - Launching a standalone server
17:26:14.780 INFO - Java: Oracle Corporation 24.76-b04
17:26:14.781 INFO - OS: Mac OS X 10.9.5 x86_64
17:26:14.793 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
17:26:14.889 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC
17:26:14.930 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4445/wd/hub
17:26:14.931 INFO - Version Jetty/5.1.x
17:26:14.931 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
17:26:14.932 INFO - Started HttpContext[/selenium-server,/selenium-server]
17:26:14.932 INFO - Started HttpContext[/,/]
17:26:14.969 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@256b8a7a
17:26:14.969 INFO - Started HttpContext[/wd,/wd]
17:26:14.973 INFO - Started SocketListener on 0.0.0.0:4445
17:26:14.973 INFO - Started org.openqa.jetty.jetty.Server@7a112202
17:26:21.139 INFO - Executing: [new session: Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]])
17:26:21.149 INFO - Creating a new session for Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]
17:26:23.530 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_76'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:175)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:111)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:88)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:108)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:57)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:172)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:129)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_76'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:69)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:53)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:54)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:214)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession.run(DefaultSession.java:168)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:59)
... 9 more
Caused by: java.lang.IllegalStateException: The driver executable does not exist: /Users/rgoldfar/selenium/./chromedrive
at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:117)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
... 14 more
17:26:23.536 WARN - Exception: The driver executable does not exist: /Users/rgoldfar/selenium/./chromedrive
17:26:23.637 INFO - Executing: [new session: Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]])
17:26:23.638 INFO - Creating a new session for Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]
17:26:23.639 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_76'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:175)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:111)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:88)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:108)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:57)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:172)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:129)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
顺便说一句,服务器能否同时处理多个客户端对一个端口的请求?还是我需要为每个客户端使用不同的端口?
指定 exe
扩展名。
类似于:
-Dwebdriver.chrome.driver=./chromedriver.exe
我运行以下没有任何问题
java -jar selenium-server-standalone-2.45.0.jar -role webdriver -nodeConfig DefaultNode.json -Dwebdriver.ie.driver=C:\Users\Saifur\Desktop\SeleniumGrid_NodeSetp\IEDriverServer.exe
你好像打错了。
我想应该是
java -jar selenium-server-standalone-2.44.0.jar -Dwebdriver.chrome.driver=./chromedriver -port 4445
您在
中错过了r
-Dwebdriver.chrome.driver=./chromedriver
我看到这个 post 关于如何 运行 2 个不同端口上的 selenium 网络驱动器服务器。
我试过这样做:
java -Dwebdriver.chrome.driver=./chromedrive -jar selenium-server-standalone-2.44.0.jar -port 4445
和运行 调用端口 4445 上的服务器的代码
但我得到这个例外:
rond-macpro:selenium eladb$ java -Dwebdriver.chrome.driver=./chromedrive -jar selenium-server-standalone-2.44.0.jar -port 4445
17:26:14.740 INFO - Launching a standalone server
17:26:14.780 INFO - Java: Oracle Corporation 24.76-b04
17:26:14.781 INFO - OS: Mac OS X 10.9.5 x86_64
17:26:14.793 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
17:26:14.889 INFO - Default driver org.openqa.selenium.ie.InternetExplorerDriver registration is skipped: registration capabilities Capabilities [{platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}] does not match with current platform: MAC
17:26:14.930 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4445/wd/hub
17:26:14.931 INFO - Version Jetty/5.1.x
17:26:14.931 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
17:26:14.932 INFO - Started HttpContext[/selenium-server,/selenium-server]
17:26:14.932 INFO - Started HttpContext[/,/]
17:26:14.969 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@256b8a7a
17:26:14.969 INFO - Started HttpContext[/wd,/wd]
17:26:14.973 INFO - Started SocketListener on 0.0.0.0:4445
17:26:14.973 INFO - Started org.openqa.jetty.jetty.Server@7a112202
17:26:21.139 INFO - Executing: [new session: Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]])
17:26:21.149 INFO - Creating a new session for Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]
17:26:23.530 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_76'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:175)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:111)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:88)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:108)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:57)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:172)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:129)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_76'
Driver info: driver.version: unknown
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:69)
at org.openqa.selenium.remote.server.DefaultDriverProvider.newInstance(DefaultDriverProvider.java:53)
at org.openqa.selenium.remote.server.DefaultDriverFactory.newInstance(DefaultDriverFactory.java:54)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:214)
at org.openqa.selenium.remote.server.DefaultSession$BrowserCreator.call(DefaultSession.java:1)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at org.openqa.selenium.remote.server.DefaultSession.run(DefaultSession.java:168)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.openqa.selenium.remote.server.DefaultDriverProvider.callConstructor(DefaultDriverProvider.java:59)
... 9 more
Caused by: java.lang.IllegalStateException: The driver executable does not exist: /Users/rgoldfar/selenium/./chromedrive
at com.google.common.base.Preconditions.checkState(Preconditions.java:197)
at org.openqa.selenium.remote.service.DriverService.checkExecutable(DriverService.java:117)
at org.openqa.selenium.remote.service.DriverService.findExecutable(DriverService.java:112)
at org.openqa.selenium.chrome.ChromeDriverService.createDefaultService(ChromeDriverService.java:89)
at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:139)
... 14 more
17:26:23.536 WARN - Exception: The driver executable does not exist: /Users/rgoldfar/selenium/./chromedrive
17:26:23.637 INFO - Executing: [new session: Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]])
17:26:23.638 INFO - Creating a new session for Capabilities [{platform=ANY, acceptSslCerts=true, browserName=chrome, args=[--enable-logging, --v=1], version=}]
17:26:23.639 WARN - Exception thrown
java.util.concurrent.ExecutionException: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
Build info: version: '2.44.0', revision: '76d78cf', time: '2014-10-23 20:02:37'
System info: host: 'N/A', ip: 'N/A', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.9.5', java.version: '1.7.0_76'
Driver info: driver.version: unknown
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.openqa.selenium.remote.server.DefaultSession.execute(DefaultSession.java:175)
at org.openqa.selenium.remote.server.DefaultSession.<init>(DefaultSession.java:111)
at org.openqa.selenium.remote.server.DefaultSession.createSession(DefaultSession.java:88)
at org.openqa.selenium.remote.server.DefaultDriverSessions.newSession(DefaultDriverSessions.java:108)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:57)
at org.openqa.selenium.remote.server.handler.NewSession.handle(NewSession.java:1)
at org.openqa.selenium.remote.server.rest.ResultConfig.handle(ResultConfig.java:112)
at org.openqa.selenium.remote.server.JsonHttpCommandHandler.handleRequest(JsonHttpCommandHandler.java:172)
at org.openqa.selenium.remote.server.DriverServlet.handleRequest(DriverServlet.java:201)
at org.openqa.selenium.remote.server.DriverServlet.doPost(DriverServlet.java:163)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at org.openqa.selenium.remote.server.DriverServlet.service(DriverServlet.java:129)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
at org.openqa.jetty.jetty.servlet.ServletHolder.handle(ServletHolder.java:428)
at org.openqa.jetty.jetty.servlet.ServletHandler.dispatch(ServletHandler.java:680)
at org.openqa.jetty.jetty.servlet.ServletHandler.handle(ServletHandler.java:571)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1526)
at org.openqa.jetty.http.HttpContext.handle(HttpContext.java:1479)
at org.openqa.jetty.http.HttpServer.service(HttpServer.java:920)
at org.openqa.jetty.http.HttpConnection.service(HttpConnection.java:820)
at org.openqa.jetty.http.HttpConnection.handleNext(HttpConnection.java:986)
at org.openqa.jetty.http.HttpConnection.handle(HttpConnection.java:837)
at org.openqa.jetty.http.SocketListener.handleConnection(SocketListener.java:243)
at org.openqa.jetty.util.ThreadedServer.handle(ThreadedServer.java:358)
at org.openqa.jetty.util.ThreadPool$PoolThread.run(ThreadPool.java:537)
Caused by: org.openqa.selenium.WebDriverException: java.lang.reflect.InvocationTargetException
顺便说一句,服务器能否同时处理多个客户端对一个端口的请求?还是我需要为每个客户端使用不同的端口?
指定 exe
扩展名。
类似于:
-Dwebdriver.chrome.driver=./chromedriver.exe
我运行以下没有任何问题
java -jar selenium-server-standalone-2.45.0.jar -role webdriver -nodeConfig DefaultNode.json -Dwebdriver.ie.driver=C:\Users\Saifur\Desktop\SeleniumGrid_NodeSetp\IEDriverServer.exe
你好像打错了。
我想应该是
java -jar selenium-server-standalone-2.44.0.jar -Dwebdriver.chrome.driver=./chromedriver -port 4445
您在
中错过了r-Dwebdriver.chrome.driver=./chromedriver