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

thebigk's avatar
Level 13

Dusk works without opening browser!

I'm facing a strange issue. I'm using Windows 10, Chrome, XAMPP, Laravel 5.5 and installed latest version of Dusk as well. When I run a simple test like visit google.com and check if it shows 'Google', the test runs, without opening the browser!

Could it be related to improper configuration of ChromeDriver? Or something else? I'd like to see Dusk performing actual actions in the browser, but that doesn't happen.

Would really appreciate if you could help me figure out what's wrong.

0 likes
2 replies
_stefanzweifel's avatar
Level 18

Since 2.0, Dusk ships with "Chrome headless" (https://developers.google.com/web/updates/2017/04/headless-chrome). "headless" means it does not open the browser-window and you can't see what Dusk is doing.

This improves the performance of your Test Suite a lot. You could override the driver-method in your DuskTestCase to remove the --headless-option like so :

    protected function driver()
    {
        $options = (new ChromeOptions)->addArguments([
            '--disable-gpu'
        ]);

        return RemoteWebDriver::create(
            'http://localhost:9515', DesiredCapabilities::chrome()->setCapability(
                ChromeOptions::CAPABILITY, $options
            )
        );
    }

Source: https://github.com/laravel/dusk/blob/2.0/stubs/DuskTestCase.stub#L34

4 likes
thebigk's avatar
Level 13

That's interesting! Works awesome!

Please or to participate in this conversation.