我一直在关注此信息https://laravel.com/docs/10.x/sail#laravel-dusk让黄昏与 sail 一起工作。
当我尝试使用以下命令运行黄昏测试时: sail dusk
...我明白:
Failed to connect to localhost port 9515 after 0 ms: Connection refused
Facebook\WebDriver\Exception\Internal\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"args":["--window-size=1920,1080"]}}]},"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"args":["--window-size=1920,1080"]}}}
你觉得这是什么?
我使用的是 Mac,默认浏览器是 Firefox。这一切都不重要(对吧?),因为我使用 sail 并且正在使用 dockerized 本地环境。
确保您在 docker-compose.yml 中定义了 selenium。如果没有,请按照此处的文档操作:https://laravel.com/docs/10.x/sail#laravel-dusk
您还需要运行“sail dusk”而不是“sail artisan dusk”。