dqn48247 2018-12-06 11:34
浏览 64

安装Laravel黄昏后显示错误

This is my code laravel dusk:-

DuskTestCase.php

namespace Tests;

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

abstract class DuskTestCase extends BaseTestCase
{
    use CreatesApplication;


    public static function prepare()
    {
        static::startChromeDriver();
    }

    /**
     * Create the RemoteWebDriver instance.
     *
     * @return \Facebook\WebDriver\Remote\RemoteWebDriver
     */
    protected function driver()
    {
        return RemoteWebDriver::create(
            'http://localhost:8000', DesiredCapabilities::chrome()
        );
    }
}

ExampleTest.php

namespace Tests\Browser;

use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
    /**
     * A basic browser test example.
     *
     * @return void
     */
    public function testBasicExample()
    {
        $this->browse(function (Browser $browser) {
            $browser->visit('/')
                    ->assertSee('Laravel');
        });
    }
}

Shows this error:-

TypeError: Argument 1 passed to Facebook\WebDriver\Remote\DesiredCapabilities::__construct() must be of the type array, null given,

https://i.stack.imgur.com/JpkMy.png

  • 写回答

1条回答 默认 最新

  • duan1983 2019-02-15 14:34
    关注

    If you aren't passing any options in then replace DesiredCapabilities::chrome() with []

    评论

报告相同问题?