Codeception (Chromedriver) tests possible?

Is it possible to run Codeception tests that use Chromedriver (or Selenium, or PhantomJS) on a site running in Local? I’m able to run WPBrowser (an extension of PHPBrowser) based tests be executing them inside the container, but doing the same thing for tests using Chromedriver doesn’t work – I’m guessing because Chromedriver is running on my host machine, while the tests are executed in the Local machine.

For reference, here’s the error message I get when I try to run them:

[ConnectionException] Can’t connect to Webdriver at http://127.0.0.1:9515/wd/hub. Please make sure that Selenium Server or PhantomJS is running.

Hi @tnorthcutt,

Sorry about this! Codeception can be tricky to set up when containers are involved.

Based off of the details, it sounds like you need to look for Webdriver/Selenium at the IP that loopbacks to your Mac/PC instead of 127.0.0.1 which will loopback to the container if used inside the container. Here’s how you can get the host machine’s IP: IP of HOST available within site container?

Thanks, @clay! That worked perfectly.

For anyone else who runs across this, here’s what I ended up with:

Relevant portion of my acceptance.suite.yml file:

        WPWebDriver:
            url: '%TEST_SITE_WP_URL%'
            host: '10.0.2.2'
            browser: chrome
            port: 9515
            window_size: 1024x768
            adminUsername: '%TEST_SITE_ADMIN_USERNAME%'
            adminPassword: '%TEST_SITE_ADMIN_PASSWORD%'
            adminPath: '/wp-admin'

10.0.2.2 is what I got by running the command @clay pointed to: "/Applications/Local by Flywheel.app/Contents/Resources/extraResources/virtual-machine/vendor/docker/osx/docker-machine" ssh local-by-flywheel "route | grep default" | awk '{ print $2 }'

This topic was automatically closed 12 hours after the last reply. New replies are no longer allowed.