facebook - 在 Homestead 上运行 Laravel Dusk

标签 facebook laravel laravel-dusk

我使用 Homestead 版本 1.0.1Laravel 版本 5.4.16。我通过阅读 the documentation 来设置 Laravel 黄昏.

但是,当我通过 ssh 运行 php artisan dusk 到我的家园时。我收到如下错误

PHPUnit 5.7.17 by Sebastian Bergmann and contributors.

E 1 / 1 (100%)

Time: 2.52 minutes, Memory: 10.00MB

There was 1 error:

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":"","args":["no-first-run"]}}}

Operation timed out after 30001 milliseconds with 0 bytes received

有没有办法解决这个问题😊?

最佳答案

是的,它可以在 Dusk 的 github 页面上找到。这是一个已知问题,他们正在努力更新下一个宅基地箱。

The basic issue is that the homestead box has no visual interface and that dusk runs a real browser, so you have to install a chromedriver if you want to use it.

但现在这对我有用: https://github.com/laravel/dusk/issues/50#issuecomment-275155974

该帖子中没有包含但对我来说是必需的: 确保你有以下权限集 cd vendor/laravel/dusk/bin; chmod 775 *

github 帖子中的步骤: 首先,需要在客户操作系统中安装 google-chrome:

$ wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
$ sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list'
$ sudo apt-get update && sudo apt-get install -y google-chrome-stable

接下来是 xvfb:

$ sudo apt-get install -y xvfb

尝试启动./vendor/laravel/dusk/bin/chromedriver-linux --port=8888. 如果你有一些关于加载库的错误(libnss3.so, libgconf-2.so .4),试试这个:

$ sudo apt-get install -y libnss3-dev libxi6 libgconf-2-4

当你看到

$ ./vendor/laravel/dusk/bin/chromedriver-linux --port=8888
Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 8888
Only local connections are allowed.
this means ChromeDriver can be started (so SupportsChrome trait should be able to start it too). You can stop this process for now (Ctrl+C).

运行

$ Xvfb :0 -screen 0 1280x960x24 &
in a separate terminal window.

您可能还想在 guest 的/etc/hosts 文件中添加您的开发域: 127.0.0.1 域.dev。

This issue is to add the chromedriver to homestead by default and will be solved mid April. https://github.com/laravel/homestead/issues/516

关于facebook - 在 Homestead 上运行 Laravel Dusk,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43337644/

相关文章:

php - Facebook Graph API PHP 以页面形式对页面上的帖子进行评论

javascript - 如何从方法中的组件访问数据

php - Laravel 自定义包路由不工作

php - Laravel Dusk NoSuchElementException/无法定位元素

android - 如何实现在所有 Activity 中可用的登录 Activity 。安卓

Android Facebook SDK AppInviteDialog 回调不工作

php - 如何使用 OAuth 对话框在移动 Web 应用程序上使用 facebook 连接

javascript - 拉维尔 5.6 : intl-tel-input compatibility issue with App. js

Laravel Serve 命令不尊重 --env 参数

laravel-5.5 - Laravel 黄昏不起作用