2
votes
  • PHPUnit 6.5.6 by Sebastian Bergmann and contributors
  • MacOS High Sierra 10.13
  • Laravel 5.5
  • Laravel Dusk
  • Chromedriver 2.35.528157
  • Chrome browser 64.0.3282.119

Error:
1) Tests\Browser\ExampleTest::testBasicExample Facebook\WebDriver\Exception\UnknownServerException: unknown error: unhandled inspector error: {"code":-32000,"message":"Cannot navigate to invalid URL"} (Session info: headless chrome=64.0.3282.119)
(Driver info: chromedriver=2.35.528157 (4429ca2590d6988c0745c24c8858745aaaec01ef),platform=Mac OS X 10.13.2 x86_64)

I have tried this solution:

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

then the next

error was:
1) Tests\Browser\ExampleTest::testBasicExample TypeError: Argument 1 passed to Facebook\WebDriver\Remote\DesiredCapabilities::__construct() must be of the type array, null given, called in /private/var/root/Documents/blvnp/phpunit_testing/PPP/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php on line 127

There are others who have the same problems. There also questions about this in stackoverflow, but those were long ago, my question is different because I am using the latest versions.

1

1 Answers

1
votes
    $options = (new ChromeOptions)->addArguments([
        '--disable-gpu',
        '--headless'
    ]);

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