我正在尝试在命令行中启动Selenium服务器,但它返回以下消息:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\a607270>java -jar selenium-server-standalone-3.4.0.jar -role hub
09:49:50.198 INFO - Selenium build info: version: '3.4.0', revision: 'unknown'
09:49:50.199 INFO - Launching Selenium Grid hub
2017-05-30 09:49:52.134:INFO::main: Logging initialized @2625ms to org.seleniumh
q.jetty9.util.log.StdErrLog
09:49:52.167 INFO - Will listen on 4444
2017-05-30 09:49:52.276:INFO:osjs.Server:main: jetty-9.4.3.v20170317
2017-05-30 09:49:52.313:INFO:osjs.session:main: DefaultSessionIdManager workerNa
me=node0
2017-05-30 09:49:52.313:INFO:osjs.session:main: No SessionScavenger set, using d
efaults
2017-05-30 09:49:52.320:INFO:osjs.session:main: Scavenging every 660000ms
2017-05-30 09:49:52.364:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletC
ontextHandler@5e955596{/,null,AVAILABLE}
Usage: <main class> [options]
Options:
--version, -version
Displays the version and exits.
Default: false
-browserTimeout
<Integer> in seconds : number of seconds a browser session is allowed to
hang while a WebDriver command is running (example: driver.get(url)). If
the
timeout is reached while a WebDriver command is still processing, the ses
sion
will quit. Minimum value is 60. An unspecified, zero, or negative value m
eans
wait indefinitely.
Default: 0
-matcher, -capabilityMatcher
<String> class name : a class implementing the CapabilityMatcher
interface. Specifies the logic the hub will follow to define whether a re
quest can
be assigned to a node. For example, if you want to have the matching proc
ess
use regular expressions instead of exact match when specifying browser
version. ALL nodes of a grid ecosystem would then use the same capability
Matcher,
as defined here.
Default: org.openqa.grid.internal.utils.DefaultCapabilityMatcher@3439f68d
-cleanUpCycle
<Integer> in ms : specifies how often the hub will poll running proxies
for timed-out (i.e. hung) threads. Must also specify "timeout" option
Default: 5000
-custom
<String> : comma separated key=value pairs for custom grid extensions.
NOT RECOMMENDED -- may be deprecated in a future revision. Example: -cust
om
myParamA=Value1,myParamB=Value2
Default: {}
-debug
<Boolean> : enables LogLevel.FINE.
Default: false
-host
<String> IP or hostname : usually determined automatically. Most commonly
useful in exotic network configurations (e.g. network with VPN)
Default: 10.56.130.102
-hubConfig
<String> filename: a JSON file (following grid2 format), which defines
the hub properties
-jettyThreads, -jettyMaxThreads
<Integer> : max number of threads for Jetty. An unspecified, zero, or
negative value means the Jetty default value (200) will be used.
-log
<String> filename : the filename to use for logging. If omitted, will log
to STDOUT
-maxSession
<Integer> max number of tests that can run at the same time on the node,
irrespective of the browser used
-newSessionWaitTimeout
<Integer> in ms : The time after which a new test waiting for a node to
become available will time out. When that happens, the test will throw an
exception before attempting to start a browser. An unspecified, zero, or
negative
value means wait indefinitely.
Default: -1
-port
<Integer> : the port number the server will use.
Default: 4444
-prioritizer
<String> class name : a class implementing the Prioritizer interface.
Specify a custom Prioritizer if you want to sort the order in which new s
ession
requests are processed when there is a queue. Default to null ( no priori
ty = FIFO
)
-role
<String> options are [hub], [node], or [standalone].
Default: hub
-servlet, -servlets
<String> : list of extra servlets the grid (hub or node) will make
available. Specify multiple on the command line: -servlet tld.company.Ser
vletA
-servlet tld.company.ServletB. The servlet must exist in the path:
/grid/admin/ServletA /grid/admin/ServletB
Default: []
-timeout, -sessionTimeout
<Integer> in seconds : Specifies the timeout before the server
automatically kills a session that hasn't had any activity in the last X
seconds. The
test slot will then be released for another test to use. This is typicall
y
used to take care of client crashes. For grid hub/node roles, cleanUpCycl
e
must also be set.
Default: 1800
-throwOnCapabilityNotPresent
<Boolean> true or false : If true, the hub will reject all test requests
if no compatible proxy is currently registered. If set to false, the requ
est
will queue until a node supporting the capability is registered with the
grid.
Default: true
-withoutServlet, -withoutServlets
<String> : list of default (hub or node) servlets to disable. Advanced
use cases only. Not all default servlets can be disabled. Specify multipl
e on
the command line: -withoutServlet tld.company.ServletA -withoutServlet
tld.company.ServletB
Default: []
java.net.BindException: Address already in use: bind
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.Net.bind(Unknown Source)
at sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)
at sun.nio.ch.ServerSocketAdaptor.bind(Unknown Source)
at org.seleniumhq.jetty9.server.ServerConnector.open(ServerConnector.jav
a:298)
at org.seleniumhq.jetty9.server.AbstractNetworkConnector.doStart(Abstrac
tNetworkConnector.java:80)
at org.seleniumhq.jetty9.server.ServerConnector.doStart(ServerConnector.
java:236)
at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(Abstract
LifeCycle.java:68)
at org.seleniumhq.jetty9.server.Server.doStart(Server.java:431)
at org.seleniumhq.jetty9.util.component.AbstractLifeCycle.start(Abstract
LifeCycle.java:68)
at org.openqa.grid.web.Hub.start(Hub.java:184)
at org.openqa.grid.selenium.GridLauncherV3$2.launch(GridLauncherV3.java:
259)
at org.openqa.grid.selenium.GridLauncherV3.main(GridLauncherV3.java:99)
任何人都可以帮我解决这个问题吗?如果需要更多信息,我可以提供。
我使用的是Windows 7 Professional,并且正在公司环境中工作,因此可能存在代理问题。
答案 0 :(得分:3)
以下是您的问题的答案:
从错误日志java.net.BindException: Address already in use: bind
可以清楚地看出, 4444
侦听的默认端口Selenium Grid Hub
正在被其他应用程序使用。因此,您可以考虑使用 Selenium Grid Hub
的其他端口,如下所示:
C:\Users>java -jar C:\Utility\selenium-server-standalone\selenium-server-standalone-3.4.0.jar -role hub -port 5786
您可以通过 http://localhost:5786/grid/console
访问Selenium Grid Server控制台如果这回答你的问题,请告诉我。