2

When I run my laravel dusk tests, the cmd displays a lot of console messages such as:

DevTools listening on ws://127.0.0.1:12802/devtools/browser/dbffc66a-0b29-4149-a1b5-8f20259770c2
[0720/101840.929:INFO:CONSOLE(44479)] "Download the Vue Devtools extension for a better development
experience:
https://github.com/vuejs/vue-devtools", source: http://localhost:8000/js/app.js (44479)
[0720/101840.929:INFO:CONSOLE(44490)] "You are running Vue in development mode.
Make sure to turn on production mode when deploying for production.
See more tips at https://vuejs.org/guide/deployment.html", source: http://localhost:8000/js/app.js (
44490)

How can I prevent this ? It displays this as it goes through each page while testing

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Raj
  • 1,928
  • 3
  • 29
  • 53

1 Answers1

5

This response is a little late, but I just came up with this problem now.

You can pass arguments to the Chrome driver to prevent console logging, as shown below.

On Laravel 5.8

test\DuskTestCase.php

...


/**
 * Create the RemoteWebDriver instance.
 *
 * @return \Facebook\WebDriver\Remote\RemoteWebDriver
 */
protected function driver()
{
    $options = (new ChromeOptions)->addArguments([
        '--disable-gpu',
        '--headless',
        '--window-size=1920,1080',
        '--log-level=3', // Add this line
        '--silent' // Add this line
    ]);

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

...

This will turn off all console messages.

dr_ermio
  • 811
  • 1
  • 10
  • 21
  • I added it, it does not seem to work for me. Any other ideas? – niko craft Dec 18 '19 at 21:48
  • 2
    This may have [changed with v75](https://stackoverflow.com/a/57043902/6576977). Try adding `$options->setExperimentalOption('excludeSwitches', [enable-logging']);` – dr_ermio Jan 03 '20 at 14:51