I would like test my laravel projet with Dusk.
But when I run php artisan dusk
I have this:
Facebook\WebDriver\Exception\WebDriverCurlException: Curl error thrown for http POST to /session with params: {"capabilities":{"firstMatch":[{"browserName":"chrome","goog:chromeOptions":{"binary":"","args":["--disable-gpu","--headle
ss","--window-size=1920,1080"]},"acceptInsecureCerts":true}]},"desiredCapabilities":{"browserName":"chrome","platform":"ANY","chromeOptions":{"binary":"","args":["--disable-gpu","--headless","--window-size=1920,1080"]},"acceptInsecu
reCerts":true}}
Could not resolve host: selenium
I've configured dusk to use my selenium container.
My config:
<?php
namespace Tests;
use Facebook\WebDriver\Chrome\ChromeOptions;
use Facebook\WebDriver\Remote\DesiredCapabilities;
use Facebook\WebDriver\Remote\RemoteWebDriver;
use Laravel\Dusk\TestCase as BaseTestCase;
abstract class DuskTestCase extends BaseTestCase
{
use CreatesApplication;
/**
* Prepare for Dusk test execution.
*
* @beforeClass
* @return void
*/
public static function prepare()
{
// static::startChromeDriver();
}
/**
* Create the RemoteWebDriver instance.
*
* @return \Facebook\WebDriver\Remote\RemoteWebDriver
*/
protected function driver()
{
$options = (new ChromeOptions)->addArguments([
'--disable-gpu',
'--headless',
'--window-size=1920,1080',
]);
return RemoteWebDriver::create(
'http://selenium:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
->setCapability('acceptInsecureCerts', true), 60*1000, 60*1000
);
}
}
Selenium is in a docker container. Selenium's configuration :
selenium:
image: selenium/standalone-chrome:3.11.0-antimony
networks:
- project
I know it's because my project do not arrive to connect to my container but I don't know how I can resolve this problem.
If someone can help me it will be nice ... Thanks a lot !
http://selenium:4444/wd/hub
Is your hub exposed with this domain address ?? Selenium:4444
Change it to IP address than selenium
Remotedrver tries to connect to selenium:4444 . It's not available if it's not dns registered , change it to 127.0.0.1 or localhost if your running locally or add your selenium hub ip if running remotely