Php http POST to/session引发Curl错误

Php http POST to/session引发Curl错误,php,laravel,chromium,headless,laravel-dusk,Php,Laravel,Chromium,Headless,Laravel Dusk,我安装了Laravel Dusk用于网站测试。关于这个问题,我尝试了Stackoverflow上的所有解决方案,但都不起作用 我需要运行无头浏览器,因为我正在Linux服务器上运行测试 chromedriver linux的当前版本为: ./vendor/laravel/dusk/bin/chromedriver-linux --v ChromeDriver 90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-h

我安装了Laravel Dusk用于网站测试。关于这个问题,我尝试了Stackoverflow上的所有解决方案,但都不起作用

我需要运行无头浏览器,因为我正在Linux服务器上运行测试

chromedriver linux的当前版本为:

 ./vendor/laravel/dusk/bin/chromedriver-linux --v
ChromeDriver 90.0.4430.24 (4c6d850f087da467d926e8eddb76550aed655991-refs/branch-heads/4430@{#429})
Chromium的当前版本为:

 chromium-browser --version --no-sandbox
Chromium 90.0.4430.93 snap

当我运行黄昏时,我得到错误:

Operation timed out after 30001 milliseconds with 0 bytes received
Curl error thrown for http POST to /session with params: {"capabilities":{"firstMatch":[{"browserName":"chrome","platformName":"linux","goog:chromeOptions":{"args":["--headless","--disable-gpu","--no-sandbox"]}}]},"desiredCapabilities":{"browserName":"chrome","platform":"linux","chromeOptions":{"args":["--headless","--disable-gpu","--no-sandbox"]}}}
有没有办法解决这个问题?我尝试添加参数--headless“,--disable gpu“,--no sandbox”,但不幸的是它不起作用。

朋友

我假设您使用的是Windows主机上的Homestead(Windows 10、Homestead 10和Laravel 8)。如果没有,我不确定这个答案是否有帮助。但这在几分钟前确实帮助了我,所以我觉得很感激

  • dash
    看起来不像
    Chromium
    ,需要一个完整的Chromium。因此:
  • cd~
    wgethttps://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo-apt-install./google-chrome-stable\u current\u amd64.deb
    
    这将下载并安装最新的稳定的谷歌浏览器

  • 一定要确保你的项目的
    供应商/laravel/dusk/bin/
    文件夹是可执行的,正如文档建议的那样。因此,在项目的根目录中:
  • chmod-R 0755供应商/拉威尔/黄昏/垃圾箱/
    
  • 确保已安装最新的Chrome驱动程序:
  • php artisan dusk:chrome驱动程序——检测 3.1。如果这会给你带来困难(无法重命名,无法移动文件,yada-yada)-这可能是因为你的驱动程序已经在运行,所以退出Homestead,然后

    
    
    返回家园,重复上面的第3步

  • 确保您能够卷曲
    应用程序的URL
    。假设它是
    laravel.app
  • 如果没有,请检查
    /etc/hosts
    ,您将看到类似于
    127.0.0.1 laravel.app
    ——符合我们关于URL的假设。这通常是由宅地本身,当你提供一个新的网站

    php工匠黄昏
    
    他成功了

    那帮我修好了

    我花了太多的时间,这本可以通过文档中的一行来节省“如果你在Windows上运行Homestead,请确保安装Google Chrome”


    快乐编码

    谢谢你。我在帖子中提到了linux。不管怎样,我搬到了Symfony Panther,它很管用:)
    curl http://laravel.app