Laravel黄昏流浪盒DesiredCapabilities :: __ construct()

时间:2017-11-01 10:14:02

标签: laravel-5 vagrant laravel-5.5 laravel-dusk

黄昏问题 在我的Mac上运行带有自定义网址的Vagrant框。我必须修改DuskTestCase.php并将http://localhost:9515替换为$this->local = http://mysite.dev$php artisan dusk tests/Browser/LoginTest.php输出以下错误:

Tests\Browser\LoginTest::testLogin
TypeError: Argument 1 passed to Facebook\WebDriver\Remote\DesiredCapabilities::__construct() must be of the type array, null given, called in /Users/gmylonas/Vagrant Projects/mywebsite/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php on line 127

/Users/gmylonas/Vagrant Projects/mywebsite/vendor/facebook/webdriver/lib/Remote/DesiredCapabilities.php:33
/Users/gmylonas/Vagrant Projects/mywebsite/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:127
/Users/gmylonas/Vagrant Projects/mywebsite/tests/DuskTestCase.php:46
/Users/gmylonas/Vagrant Projects/mywebsite/vendor/laravel/dusk/src/TestCase.php:210
/Users/gmylonas/Vagrant Projects/mywebsite/vendor/laravel/framework/src/Illuminate/Support/helpers.php:762
/Users/gmylonas/Vagrant Projects/mywebsite/vendor/laravel/dusk/src/TestCase.php:211
/Users/gmylonas/Vagrant Projects/mywebsite/vendor/laravel/dusk/src/TestCase.php:117
/Users/gmylonas/Vagrant Projects/mywebsite/vendor/laravel/dusk/src/TestCase.php:89
/Users/gmylonas/Vagrant Projects/mywebsite/tests/Browser/LoginTest.php:23

当我替换$this->local = http://www.google.com:80$browser->visit('/')->dump();时,它会转储Google网页的内容! $this->local = http://localhost:9515将转储空白页

<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body></body></html>

:问题:为什么它不适用于我的盒子网址以及如何解决它?

谢谢你的到来。

1 个答案:

答案 0 :(得分:4)

问题是你不应该将http://localhost:9515更新为其他任何东西。这是selenium驱动程序,默认情况下它使用此端口,它应该没有任何问题。

默认运行时:

$browser->visit('/')

它应该访问您网页的主网址,而不进行任何其他更改。但是,根据您的应用程序,您可能需要在.env文件中设置APP_URL,尤其是在您的应用程序进行一些域检查时。