Search code examples
behatmink

Mink and Behat: Is there a way to launch selenium (Chrome) in background?


When running tests, I would like not to be bothered by Chrome popping-up every time Behat launches a scenario needing Chrome.

I know there is a maximizeWindow() method for session objects, but nothing like "minimize".


Solution

  • Nowadays, you can set Chrome to run in headless mode like so (behat.yml):

    default:
        extensions:
            Behat\MinkExtension:
                javascript_session: browser
                sessions:
                    browser:
                        selenium2:
                            browser: chrome
                            capabilities:
                                chrome:
                                    switches:
                                        - "--headless"