问题
Selenium-server-standalone has a 5 seconds delay while starting. If I run selenium with debug option it shows that the delay is caused by New random session seed
.
I start Selenium server with java -jar selenium-server-standalone-2.44.0.jar
.
If I want to specify chromedriver then I write java -jar selenium-server-standalone-2.44.0.jar -Dwebdriver.chrome.driver=chromedriver_2.11
It happens with:
- OSX 10.9.5 and OSX 10.10
- Java 1.7.0_51 (update 67 and update 71)
- selenium-server-standalone 2.42.0, 2.43.1, 2.44.0
- with and without chromedriver (2.9, 2.10, 2.11)
- running as sudo and as non-priveleged user
From what I know on other machines with the same configuration there is no such delay.
It may seem that 5 seconds is nothing, but I have another issue that most probably is caused by the same problem. It gives me 1 minute of waiting instead of few seconds.
Here is the log
11:22:50.445 INFO - Launching a standalone server
11:22:50.820 INFO - Java: Oracle Corporation 24.51-b03
11:22:50.820 INFO - OS: Mac OS X 10.10 x86_64
11:22:50.948 INFO - v2.44.0, with Core v2.44.0. Built from revision 76d78cf
11:22:50.948 INFO - Selenium server running in debug mode.
11:22:51.001 DEBUG - add component: SocketListener0@0.0.0.0:4444
11:22:51.022 DEBUG - add component: org.openqa.jetty.http.ResourceCache@50265e47
11:22:51.046 DEBUG - add component: org.openqa.selenium.server.ProxyHandler in HttpContext[/,/]
11:22:51.065 DEBUG - add component: HttpContext[/,/]
11:22:51.070 DEBUG - Added HttpContext[/,/] for host *
11:22:51.071 DEBUG - add component: org.openqa.jetty.http.ResourceCache@36264c17
11:22:51.073 DEBUG - added SC{BASIC,null,user,CONFIDENTIAL} at /org/openqa/selenium/tests/html/basicAuth/*
11:22:51.107 DEBUG - add component: org.openqa.jetty.http.handler.SecurityHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.111 DEBUG - add component: org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.123 DEBUG - add component: org.openqa.selenium.server.SessionExtensionJsHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.125 DEBUG - add component: org.openqa.selenium.server.htmlrunner.SingleTestSuiteResourceHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.126 DEBUG - add component: org.openqa.selenium.server.htmlrunner.SeleniumHTMLRunnerResultsHandler@6d9d3901
11:22:51.132 DEBUG - add component: HttpContext[/selenium-server,/selenium-server]
11:22:51.132 DEBUG - Added HttpContext[/selenium-server,/selenium-server] for host *
11:22:51.242 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
11:22:51.446 DEBUG - add component: org.openqa.jetty.http.ResourceCache@61f3318a
11:22:51.483 DEBUG - add component: org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.483 DEBUG - add component: HttpContext[/selenium-server/driver,/selenium-server/driver]
11:22:51.484 DEBUG - Added HttpContext[/selenium-server/driver,/selenium-server/driver] for host *
11:22:51.484 DEBUG - add component: org.openqa.jetty.http.ResourceCache@c3b626c
11:22:51.528 DEBUG - add component: WebDriver remote server
11:22:51.568 DEBUG - add component: org.openqa.jetty.jetty.servlet.HashSessionManager@5298d146
11:22:51.568 DEBUG - add component: org.openqa.jetty.jetty.servlet.ServletHandler@2ed37507
11:22:51.596 INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:4444/wd/hub
11:22:51.596 DEBUG - add component: HttpContext[/wd,/wd]
11:22:51.597 DEBUG - Added HttpContext[/wd,/wd] for host *
11:22:51.597 DEBUG - Starting org.openqa.jetty.jetty.Server@a5bdce3
11:22:51.598 INFO - Version Jetty/5.1.x
11:22:51.598 DEBUG - LISTENERS: [SocketListener0@0.0.0.0:4444]
11:22:51.598 DEBUG - HANDLER: {null={/selenium-server/driver/*=[HttpContext[/selenium-server/driver,/selenium-server/driver]], /selenium-server/*=[HttpContext[/selenium-server,/selenium-server]], /=[HttpContext[/,/]], /wd/*=[HttpContext[/wd,/wd]]}}
11:22:51.599 DEBUG - Starting HttpContext[/selenium-server/driver,/selenium-server/driver]
11:22:51.612 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5eb1404f for HttpContext[/selenium-server/driver,/selenium-server/driver]
11:22:51.612 INFO - Started HttpContext[/selenium-server/driver,/selenium-server/driver]
11:22:51.612 DEBUG - Starting HttpContext[/selenium-server,/selenium-server]
11:22:51.612 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5eb1404f for HttpContext[/selenium-server,/selenium-server]
11:22:51.613 DEBUG - Started org.openqa.jetty.http.handler.SecurityHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.613 DEBUG - Started org.openqa.selenium.server.StaticContentHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.613 DEBUG - Started org.openqa.selenium.server.SessionExtensionJsHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.613 DEBUG - Started org.openqa.selenium.server.htmlrunner.SingleTestSuiteResourceHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.613 DEBUG - Started org.openqa.selenium.server.SeleniumDriverResourceHandler in HttpContext[/selenium-server,/selenium-server]
11:22:51.613 INFO - Started HttpContext[/selenium-server,/selenium-server]
11:22:51.614 DEBUG - Starting HttpContext[/,/]
11:22:51.614 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5eb1404f for HttpContext[/,/]
11:22:51.614 DEBUG - Started org.openqa.selenium.server.ProxyHandler in HttpContext[/,/]
11:22:51.614 INFO - Started HttpContext[/,/]
11:22:51.614 DEBUG - Starting HttpContext[/wd,/wd]
11:22:51.614 DEBUG - Init classloader from null, sun.misc.Launcher$AppClassLoader@5eb1404f for HttpContext[/wd,/wd]
11:22:51.614 DEBUG - Starting org.openqa.jetty.jetty.servlet.ServletHandler@2ed37507
11:22:51.614 DEBUG - New random session seed
11:22:56.882 DEBUG - Session scavenger period = 30s
11:22:56.890 DEBUG - Started holder of class org.openqa.selenium.remote.server.DriverServlet
11:22:56.891 INFO - Started org.openqa.jetty.jetty.servlet.ServletHandler@2ed37507
11:22:56.891 INFO - Started HttpContext[/wd,/wd]
11:22:56.928 INFO - Started SocketListener on 0.0.0.0:4444
11:22:56.928 INFO - Started org.openqa.jetty.jetty.Server@a5bdce3
来源:https://stackoverflow.com/questions/26685956/slow-startup-of-selenium-server-standalone-on-osx