Search code examples
codeception

Error message when trying to run ChromeDriver for codeception


I am wanting to use Webdriver in my codeception acceptance tests and am getting errors. I see I have to have the chromedriver running and tried running it from the command window and it seems to run fine using: chromedriver --url-base=/wd/hub. I want to use the RunProcess extension so added this to my acceptance.suite.yml file:

actor: AcceptanceTester
extensions:
    enabled:
        - Codecption\Extensions\RunProcess:
            - chromedriver
modules:
    enabled:
        - WebDriver:
            url: 'http://localhost/flightserve/'
            browser: chrome
        - \Helper\Acceptance
step_decorators: ~

and I get this error message and do not know hoe it needs to be defined. Class Codecption\Extensions\RunProcess is not defined. Autoload it or include into '_bootstrap.php' file of 'tests' directory


Solution

  • A few issues with your code:

    • You have some typos with the extension path. It should be Codeception\Extension\RunProcess. So singular 'Extension' and 'Codeception' spelt correctly.
    • You may still hit issues because the chromedriver hasn't properly started up before the test suite tries to run. You could try introducing a short delay using sleep:
    - Codeception\Extension\RunProcess:
        0: chromedriver --url-base=/wd/hub
        sleep: 5