Search code examples
javascripttestingphantomjscasperjs

Casperjs/Phantomjs does not respect hosts file


I am trying to run tests against my vagrant box with lives at 192.168.0.100. In my hosts file I have 192.168.0.100 lc.mysite.com and the site loads fine and works normally at that url with chrome.

However, when I try and run my tests against it, the url fails and never loads anything. Remote urls work fine but the local ones are just failing.

How can I get casperjs to respect my hosts file? Or is it something else?


Solution

  • If you are using a self-signed SSL certificate (e.g. on your development box), set phantomjs option

    --ignore-ssl-errors=true

    From the documentation:

    --ignore-ssl-errors Ignores SSL errors (expired/self-signed certificate errors): 'true' or 'false' (default)