I'm attempting to use Laravel Dusk alongside Selenium to run browser tests. I have my platform and selenium running within docker that are composed together in the same dockerfile.
Each time I try to run php artisan dusk I get the error messsage:
Facebook\WebDriver\Exception\UnknownErrorException: unknown error: net::ERR_CONNECTION_REFUSED
(Session info: chrome=113.0.5672.63)
I have tried switching APP URL (localhost runs on port 8990) in every combination alongside other flags within DuskTestCase. Selenium grid opens correctly at http://127.0.0.1:4444/
docker-compose.yml
chrome:
image: selenium/node-chrome:4.9.1-20230508
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
edge:
image: selenium/node-edge:4.9.1-20230508
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
firefox:
image: selenium/node-firefox:4.9.1-20230508
shm_size: 2gb
depends_on:
- selenium-hub
environment:
- SE_EVENT_BUS_HOST=selenium-hub
- SE_EVENT_BUS_PUBLISH_PORT=4442
- SE_EVENT_BUS_SUBSCRIBE_PORT=4443
selenium-hub:
image: selenium/hub:4.9.1-20230508
container_name: selenium-hub
ports:
- "4442:4442"
- "4443:4443"
- "4444:4444"
DuskTestCase.php
$options = (new ChromeOptions)->addArguments(collect([
$this->shouldStartMaximized() ? '--start-maximized' : '--window-size=1920,1080',
])->unless($this->hasHeadlessDisabled(), function (Collection $items) {
return $items->merge([
'--disable-gpu',
'--headless=new',
'--whitelisted-ips=""',
'--disable-dev-shm-usage'
]);
})->all());
return RemoteWebDriver::create(
'http://selenium-hub:4444/wd/hub', DesiredCapabilities::chrome()->setCapability(
ChromeOptions::CAPABILITY, $options
)
);
I'm running out of things to try at this point. For reference, my system uses Ubuntu.