Moodle Behat: Accessing host chromedriver from docker
From time to time, you may want Behat tests on your docker container to connect to chromedriver on your host so that you can easily debug a failing Behat test.
To do this, it is important that chromedriver is started as follows:
chromedriver –whitelisted-ips= –allowed-origins=host.docker.internal
Your Moodle Behat config will then need to reference your host. This is done by setting ‘wd_host’ to ‘host.docker.internal:9515’
$CFG->behat_profiles = [
‘default’ => [
‘browser’ => ‘chrome’,
‘tags’ => ‘@javascript’,
‘wd_host’ => ‘host.docker.internal:9515’
],
‘headless’ => [
‘browser’ => ‘chrome’,
‘wd_host’ => ‘host.docker.internal:9515’,
‘tags’ => ‘@javascript’,
‘capabilities’ => [
‘chrome’ => [
‘switches’ => [
‘–no-sandbox’,
‘–headless’,
‘–disable-gpu’
]
],
‘extra_capabilities’ => [
‘chromeOptions’ => [
‘args’ => [
‘headless’,
‘no-gpu’
]
]
]
]
]
];
Running Behat on your docker container with the profile flag “headless” will allow you to see the tests running on your host. E.g:
vendor/bin/behat –config /yourmoodlepath/behat/behatrun/behat/behat.yml –profile=headless Source: https://brudinie.medium.com/feed
- Job offered: Senior Technical Architect / Consultant – 30th June 2026
- ElearningWorld.org is for sale – 23rd June 2026
- Proyecto EdTech Colombia: Plataforma Moodle Gamificada, Escalable y Adaptativa – 18th October 2025

