4

Does anyone encountered this type of error when you run laravel 5.6 dusk

ERRor Log in the Terminal:

Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"","args":["--disable-gpu","--headless"]}}}

Failed to connect to localhost port 9515: Connection refused
Rohit Sharma
  • 1,271
  • 5
  • 19
  • 37

2 Answers2

7

Make sure your chrome-driver is executable and running. Try following command

./vendor/laravel/dusk/bin/chromedriver-linux --port=8888

You should see following output

Starting ChromeDriver 2.x.x (649f9b868f6783ec9de71c123212b908bf3b232e) on port 8888 Only local connections are allowed.

  • ./vendor/laravel/dusk/bin/chromedriver-linux: error while loading shared libraries: libnss3.so: cannot open shared object file: No such file or directory – Viraj Singh Oct 28 '21 at 13:28
  • 1
    @VirajSingh This is a different issue. Here libnss3 library missing, you have to install it. Somebody has already explain it here. https://stackoverflow.com/questions/58134793/error-while-loading-shared-libraries-libnss3-so-while-running-gtlab-ci-job-to – Yuvrajsinh Jhala Oct 28 '21 at 14:28
0

This error is sometimes not really transparent. I was having this issue too and thought it was related to a bad Chromedriver installation or something regarding the driver, however, it turned out it was caused by the wrong logic of one of my classes that were responsible for loading and processing the JSON data, some finding in the database and turning data into Laravel collections.

I was loading malformed JSON and my checks for JSON sanity were false positive, so my method thought JSON data was ok, while it contained empty arrays [] or exception messages from the other server. So for anyone having the same problem and tried dealing with the Chrome driver and it didn't work, I would suggest taking the hard path and starting digging into your method's logic a little bit more and checking if the outputs of functions and methods are ok with dd(...).

Banik
  • 320
  • 4
  • 9