安装Laravel黄昏后显示错误

时间:2018-12-06 11:34:35

标签: php laravel ubuntu-18.04

这是我的代码laravel黄昏:-

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');
        });
    }
}

显示此错误:-

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 个答案:

答案 0 :(得分:0)

如果未传递任何选项,则将DesiredCapabilities::chrome()替换为[]