Installed WebDriver, it seems everything works. Run like this:

DISPLAY=:99 xvfb-run -a -n 1 -l -s "-screen 0, 1024x768x8" java -jar selenium-server-standalone-3.5.0.jar 

It starts. Then, using PHP, I try to connect and open a browser:

 namespace Facebook\WebDriver; use Facebook\WebDriver\Remote\HttpCommandExecutor; use Facebook\WebDriver\Remote\DesiredCapabilities; use Facebook\WebDriver\Remote\RemoteWebDriver; require_once('vendor/autoload.php'); $host = 'http://localhost:4444/wd/hub'; $driver = RemoteWebDriver::create($host, DesiredCapabilities::chrome()); 

At startup, an error occurs:

 PHP Catchable fatal error: Argument 1 passed to Facebook\WebDriver\Remote\DesiredCapabilities::__construct() must be of the type array, null given, called in /root/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php on line 127 and defined in /root/vendor/facebook/webdriver/lib/Remote/DesiredCapabilities.php on line 33 

The process itself Selenium gives:

 2017-08-17 11:41:56.927:INFO:osjshC.ROOT:qtp405662939-9: org.openqa.selenium.remote.server.WebDriverServlet-675d3402: Initialising WebDriverServlet 11:41:57.192 INFO - Binding default provider to: org.openqa.selenium.chrome.ChromeDriverService 11:41:57.193 INFO - Found handler: org.openqa.selenium.remote.server.BeginSession@51253f85 11:41:57.200 INFO - /session: Executing POST on /session (handler: BeginSession) 11:41:57.262 INFO - Capabilities are: Capabilities {browserName=chrome, platformName=ANY, platform=ANY, } 11:41:57.267 INFO - Capabilities {browserName=chrome, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) 11:41:57.268 INFO - Capabilities {browserName=chrome, platformName=ANY, platform=ANY, } matched class org.openqa.selenium.remote.server.ServicedSession$Factory (provider: org.openqa.selenium.chrome.ChromeDriverService) 2017-08-17 11:41:57.305:WARN:osjs.HttpChannel:qtp405662939-9: /wd/hub/session java.lang.NullPointerException at com.google.gson.JsonPrimitive.isPrimitiveOrString(JsonPrimitive.java:278) at com.google.gson.JsonPrimitive.setValue(JsonPrimitive.java:101) at com.google.gson.JsonPrimitive.<init>(JsonPrimitive.java:65) at org.openqa.selenium.remote.server.ExceptionHandler.lambda$execute$0(ExceptionHandler.java:82) at java.util.stream.ReferencePipeline$3$1.accept(Unknown Source) at java.util.Spliterators$ArraySpliterator.forEachRemaining(Unknown Source) at java.util.stream.AbstractPipeline.copyInto(Unknown Source) at java.util.stream.AbstractPipeline.wrapAndCopyInto(Unknown Source) at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(Unknown Source) at java.util.stream.AbstractPipeline.evaluate(Unknown Source) at java.util.stream.ReferencePipeline.collect(Unknown Source) at org.openqa.selenium.remote.server.ExceptionHandler.execute(ExceptionHandler.java:88) at org.openqa.selenium.remote.server.WebDriverServlet.handle(WebDriverServlet.java:247) at org.openqa.selenium.remote.server.WebDriverServlet.doPost(WebDriverServlet.java:151) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at org.openqa.selenium.remote.server.WebDriverServlet.service(WebDriverServlet.java:111) at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) at org.seleniumhq.jetty9.servlet.ServletHolder.handle(ServletHolder.java:841) at org.seleniumhq.jetty9.servlet.ServletHandler.doHandle(ServletHandler.java:535) at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:143) at org.seleniumhq.jetty9.security.SecurityHandler.handle(SecurityHandler.java:548) at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) at org.seleniumhq.jetty9.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) at org.seleniumhq.jetty9.servlet.ServletHandler.doScope(ServletHandler.java:473) at org.seleniumhq.jetty9.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) at org.seleniumhq.jetty9.server.handler.ContextHandler.doScope(ContextHandler.java:1155) at org.seleniumhq.jetty9.server.handler.ScopedHandler.handle(ScopedHandler.java:141) at org.seleniumhq.jetty9.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) at org.seleniumhq.jetty9.server.Server.handle(Server.java:564) at org.seleniumhq.jetty9.server.HttpChannel.handle(HttpChannel.java:317) at org.seleniumhq.jetty9.server.HttpConnection.onFillable(HttpConnection.java:251) at org.seleniumhq.jetty9.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) at org.seleniumhq.jetty9.io.FillInterest.fillable(FillInterest.java:110) at org.seleniumhq.jetty9.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) at org.seleniumhq.jetty9.util.thread.Invocable.invokePreferred(Invocable.java:128) at org.seleniumhq.jetty9.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222) at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294) at org.seleniumhq.jetty9.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126) at org.seleniumhq.jetty9.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:672) at org.seleniumhq.jetty9.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:590) at java.lang.Thread.run(Unknown Source) 

And here, I do not know which way to look, Google did not help.

  • Do you have firefox installed? When launching, specify the capability of firefox, and in the selenium log - chrome: 11:41:57.262 INFO - Capabilities are: Capabilities {browserName=chrome, platformName=ANY, platform=ANY, } - Alexander Oleynikov
  • I apologize. Just when testing, I tried both firefox and chrome, and, it turns out, I mixed up the logs. But it is not scary in this case, when trying to use both firefox and chrome - the error is the same. I understand, based on the error, that the data is transmitted incorrectly (the array should be, and null is transmitted?), But as I do according to the instructions, one of the Internet, I can not understand what exactly I am doing wrong. - hender
  • But just in case, I corrected the php code in the question, changed the line indicating Fox to the line with chrome. - hender
  • I also noticed this moment: when you go to your browser at http: // (hub ip): 5555 / wd / hub, a window opens with a list of sessions and the ability to create a new one. When creating a request for a session page, it gives an error 500. Maybe WebDriver itself is installed with an error or something like that? - hender
  • 3.5 fresh version. Try or add the option -enablePassThrough false to start the server. Or the old version. - Alexander Oleynikov

0