javaseleniumjettyselenium-server

Selenium server "Not Found"


I am using the latest Selenium Standalone Server (3.0.0-beta2) on a Windows machine (Windows Server 2012 R2 Standard) Java is installed (java version "1.8.0_101").

I am executing the JAR with the following command:

java -jar selenium-server-standalone-3.0.0-beta1.jar -port 8888

Now when I request http://localhost:8888 I just get a HTTP 404 error by Jetty:

HTTP ERROR: 404

Problem accessing /. Reason:

    Not Found
Powered by Jetty://

The port 8888 is free and is not used by any other program.

This is the console output when I start the server:

11:17:26.292 INFO - Selenium build info: version: '3.0.0-beta1',     revision: '8e4315c'
11:17:26.292 INFO - Launching a standalone Selenium Server
2016-08-03 11:17:26.371:INFO::main: Logging initialized @1176ms
11:17:26.542 INFO - Driver class not found: com.opera.core.systems.OperaDriver
11:17:26.542 INFO - Driver provider com.opera.core.systems.OperaDriver is not registered
11:17:26.558 INFO - Driver provider org.openqa.selenium.safari.SafariDriver registration is skipped:
registration capabilities Capabilities [{browserName=safari, version=, platform=MAC}] does not match the current platform WIN8
2016-08-03 11:17:26.700:INFO:osjs.Server:main: jetty-9.2.15.v20160210
2016-08-03 11:17:26.793:INFO:osjsh.ContextHandler:main: Started o.s.j.s.ServletContextHandler@6d8a00e3{/,null,AVAILABLE}
2016-08-03 11:17:27.027:INFO:osjs.ServerConnector:main: Started ServerConnector@1d057a39{HTTP/1.1}{0.0.0.0:8888}
2016-08-03 11:17:27.027:INFO:osjs.Server:main: Started @1839ms
11:17:27.043 INFO - Selenium Server is up and running

When trying to instantiate a RemoteWebDriver (with the .NET API) I get the following exception:

new RemoteWebDriver(new Uri("http://127.0.0.1:8888"), DesiredCapabilities.HtmlUnitWithJavaScript())

An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll

Additional information: Unexpected error.

Error 405

HTTP ERROR: 405

Problem accessing /session. Reason:

    HTTP method POST is not supported by this URL


Powered by Jetty://


Solution

  • The end-point you are specifying when you instantiate RemoteWebDriver is incorrect.

    Please change "http://127.0.0.1:8888" to "http://127.0.0.1:8888/wd/hub" and try again.

    The reason why http://localhost:8888 gives you an error is because there's no default servlet that is defined to serve all end-points. That is what

    HTTP ERROR: 404
    
    Problem accessing /. Reason:
    
        Not Found
    Powered by Jetty://
    

    is hinting at. If it was a port related error, you would see an error from Java with a JVM_Bind message when you try to start off your server itself.

    Lastly, you seem to be starting a selenium server and then using RemoteWebDriver to talk to it. Any specific reason why you aren't involving a Grid setup in this case ?

    If you intend to run your selenium server in a different machine and your tests are spun off in a different machine, you should consider leveraging the Selenium Grid for that.

    If you run the selenium server in the same machine from where your tests are executed, then you are better off skipping the use of selenium server and just resort to using the concrete browser implementations directly.