Run Headless Chrome on background


For my Behat tests I would need to run Chrome on background:

      - run:
          name: Execute Chrome in Background
          command: google-chrome-stable --headless --no-default-browser-check --no-first-run --disable-translate --remote-debugging-port=9222 --disable-gpu
          background: true

and I would expect command curl to return Chrome version information. This works out of box with Travis, however after several days of trying I cannot get this to work with either on Circle v1 or on Circle v2. It either does not respond to curl or gives Step was canceled when running --headless

My image is circleci/php:7.1-apache-browsers


I’d expect this to work, but if you are stuck, then you could run your tests inside Docker or Docker Compose. That’s what I do, and it gives me complete flexibility to start up background tasks before running the test suite.

However, it may be worth trying a few more things with your current approach. Can you create another run command to do ps aux to see if google-chrome-stable is still in the process list? Or maybe it’s worth doing a command after this to sleep, in case it is going to background before the listener starts up?


Thanks, sleep helped, builds still fails randomly because it cannot connect to Chrome.


Do you mean it sometimes connects to Chrome? If so, increase your sleep length. What value are you using?


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