Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tobyreed's avatar

Failed to connect to localhost port 9515: Connection refused

When trying to run a test using laravel dusk I get this:

Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"w3c":false,"binary":""}}}     

Failed to connect to localhost port 9515: Connection refused

This was working a couple of days ago and now it is not? Any ideas?

0 likes
5 replies
tobyreed's avatar

This seems to be for ubuntu. Sorry I forgot to say I am using WSL on Windows

wq9578's avatar

I also encountered the same problem on current macOS. Suddenly connecting to localhost fails, but remote hosts still can be connected too. Any solution? I already re-installed Dusk, and also updated Chrome.

Error message:

   PHPUnit\Framework\ExceptionWrapper 

  Curl error thrown for http POST to /session with params: {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["--window-size=1920,1080","--disable-gpu"]}}]},"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"args":["--window-size=1920,1080","--disable-gpu"]}}}

Failed to connect to localhost port 9515 after 0 ms: Couldn't connect to server

  at vendor/php-webdriver/webdriver/lib/Remote/HttpCommandExecutor.php:346
    342▕             if (is_array($params) && !empty($params)) {
    343▕                 $msg .= sprintf(' with params: %s', json_encode($params, JSON_UNESCAPED_SLASHES));
    344▕             }
    345▕ 
  ➜ 346▕             throw new WebDriverCurlException($msg . "\n\n" . $error);
    347▕         }
    348▕ 
    349▕         $results = json_decode($raw_results, true);
    350▕ 



  Tests:  1 failed
  Time:   0.24s

Please or to participate in this conversation.