Laravel Dusk Testing在服务器上有错误,将带参数的http POST抛出到/ session时抛出卷曲错误

时间:2018-11-18 13:26:06

标签: laravel selenium-chromedriver plesk laravel-dusk

我想请我在Plesk Server上尝试以下说明:

  

php工匠黄昏

将发生以下错误:

1) Tests\Browser\ExampleTest::testBasicExample
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary" :".\/vendor\/laravel\/dusk\/bin\/chromedriver-linux","args":["--disable-gpu","--headless","--no-sandbox"," --verbose","--window-size=1024,768"]}}}

Failed connect to localhost:9515; Connection refused

/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/facebook/webdriver/lib/Remote/HttpCommandExecutor.php:292
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/facebook/webdriver/lib/Remote/RemoteWebDriver.php:126
/var/www/vhosts/fanswoo.com/fanswoo-framework/tests/DuskTestCase.php:43
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:192
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/framework/src/Illuminate/Support/helpers.php:754
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php: 193
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:93
/var/www/vhosts/fanswoo.com/fanswoo-framework/vendor/laravel/dusk/src/Concerns/ProvidesBrowser.php:64
/var/www/vhosts/fanswoo.com/fanswoo-framework/tests/Browser/ExampleTest.php:22

我怀疑Chrome驱动程序无法执行,因此我使用以下命令进行检测:

  

./ vendor / laravel / dusk / bin / chromedriver-linux

返回结果如下:

  

在端口9515上启动ChromeDriver 2.43.600233(523efee95e3d68b8719b3a1c83051aa63aa6b10d)   仅允许本地连接。

表示ChromeDriver可以正常打开。 该代码也可以在本地计算机上检测到。仅当在Plesk Server中执行黄昏命令时,才会发生错误。请问我应该继续做神还是要修改什么?谢谢!

服务器规格如下:

CentOS 7.5

PHP 7.1

DB SQLite3

Laravel 5.7版

ChromeDriver 69版

1 个答案:

答案 0 :(得分:0)

如果您能够成功启动chromedriver,现在尝试使用相应的端口访问以下网址。 http://localhost:{port}/status

例如,在上述消息中,服务器在端口9515上启动。访问浏览器http://localhost:9515/status中的网址

enter image description here

您应该获得上面的消息,指示服务器可以通过主机名localhost来访问

如果您无法访问,请解决特定问题