jeudi 23 mai 2019

Dusk Test for Browser “DevToolsActivePort file doesn't exist”

I'm running the example test of Laravel Dusk for browser, but when I execute php artisan dusk I got an error

Using: * Ubuntu 18 * Laravel 5.8 * Dusk 5.1 * ChromeDriver 74 * apache2

This is my DuskTestCase.php:

    <?php

    namespace Tests;

    use Laravel\Dusk\TestCase as BaseTestCase;
    use Facebook\WebDriver\Chrome\ChromeOptions;
    use Facebook\WebDriver\Remote\RemoteWebDriver;
    use Facebook\WebDriver\Remote\DesiredCapabilities;

    abstract class DuskTestCase extends BaseTestCase
    {
    use CreatesApplication;

/**
 * Prepare for Dusk test execution.
 *
 * @beforeClass
 * @return void
 */
public static function prepare()
{
    static::startChromeDriver();
}

/**
 * Create the RemoteWebDriver instance.
 *
 * @return \Facebook\WebDriver\Remote\RemoteWebDriver
 */
protected function driver()
{
    $options = (new ChromeOptions)->addArguments([
        '--disable-gpu',
        '--headless',
        '--window-size=1920,1080',
        '--disable-dev-shm-usage',
        '--no-sandbox'
    ]);

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

}

This is the error:

    1) Tests\Browser\ExampleTest::testBasicExample
    Facebook\WebDriver\Exception\UnknownServerException: unknown error: Chrome failed to start: exited abnormally
      (unknown error: DevToolsActivePort file doesn't exist)
      (The process started from chrome location /snap/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.)
      (Driver info: chromedriver=74.0.3729.6 (255758eccf3d244491b8a1317aa76e1ce10d57e9-refs/branch-heads/3729@{#29}),platform=Linux 4.18.0-20-generic x86_64)

Aucun commentaire:

Enregistrer un commentaire