You have a space in the url
'http:// localhost:9515',
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi! I have a fresh install of Laravel 8.75 with Dusk 6.22 on Ubuntu 20.04. I have installed dusk correctly, using php artisan dusk:install. To run tests, I am simply calling php artisan dusk, but even trivial tests are failing with the error below. For example, if I call $browser->visit('/anypage'), I get the following output in the browser, so the test fails.
{ "value":
{ "error":"unknown command",
"message":"unknown command: unknown command: anypage",
"stacktrace":"#0 0x5561bf5e33e3 \u003Cunknown>\n#1 0x5561bf348468 \u003Cunknown>\n#2 0x5561bf3991de \u003Cunknown>\n#3 0x5561bf398f57 \u003Cunknown>\n#4 0x5561bf31f634 \u003Cunknown>\n#5 0x5561bf32044a \u003Cunknown>\n#6 0x5561bf60ff56 \u003Cunknown>\n#7 0x5561bf6272ad \u003Cunknown>\n#8 0x5561bf611dae \u003Cunknown>\n#9 0x5561bf627c34 \u003Cunknown>\n#10 0x5561bf605be2 \u003Cunknown>\n#11 0x5561bf31f206 \u003Cunknown>\n#12 0x7f5f2c10d0b3 \u003Cunknown>\n"}}
This is my driver() function:
protected function driver()
{
$options = (new ChromeOptions)->addArguments(collect([
'--window-size=1920,1080',
])->unless($this->hasHeadlessDisabled(), function ($items) {
return $items->merge([
'--disable-gpu',
'--headless',
]);
})->all());
return RemoteWebDriver::create(
$_ENV['DUSK_DRIVER_URL'] ?? 'http:// localhost:9515',
DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
}
And in the .env file, I have set APP_URL=http:// localhost:9515 (ignore the space after http; as a newly-registered member, the forum doesn't let me post URLs). I have tried replacing localhost with 127.0.0.1 and even tried launching the chromedriver manually, to no avail.
I am running Google Chrome 99.0.4844.84 and Chromium 99.0.4844.84 snap with ChromeDriver 99.0.4844.51. I first faced the problem on an old installation of Laravel 5.4, which is why I attempted a fresh install.
Has anyone else faced the same problem? What do you suggest I do?
EDIT: I've tested with a few options. One option changes the output of php artisan dusk: the --headless option. With the --headless option, I get the unknown command error. Without the --headless option, the test doesn't even start, and I get the following error:
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: Chrome failed to start: exited abnormally.
(unknown error: DevToolsActivePort file doesn't exist)
(The process started from chrome location /usr/bin/google-chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
Please or to participate in this conversation.