How to automate recorded (web) test-cases?

Hi,

I have successfully recorded test-cases using ‘Record Web’, that play back perfectly well as long as I run them using either Chrome or Firefox.

But:
Test cases never work when trying to run them using a headless browser.

How can I aiutomate running the test cases?