forked from theintern/intern
-
Notifications
You must be signed in to change notification settings - Fork 0
Using Intern with PhantomJS
csnover edited this page Nov 20, 2014
·
15 revisions
PhantomJS is not a suitable replacement for testing in real browsers. Do not use PhantomJS unless you are aware of the caveats of testing against fake browsers like PhantomJS. If don’t know these caveats, and just want a headless browser for testing, install xvfb and ChromeDriver and use xvfb-run -s "-screen 0 1280x1024x24" ./chromedriver to test using a real copy of Chrome.
Using a local PhantomJS installation with Intern is very simple:
- In your Intern configuration, set
environments: [ { browserName: 'phantomjs' } ]andtunnel: 'NullTunnel' - Ensure that the directory containing the
phantomjsexecutable is in yourPATH(this will typically be the case if you installed withnpm install -g phantomjs) - Start your local Selenium server (
java -jar selenium-server-standalone-2.xx.x.jar) - Run
intern-runner config=path/to/config
Note that PhantomJS must be used with Selenium server. PhantomJS’s built-in WebDriver server violates the HTTP specification (at least up to PhantomJS 1.9.8), which prevents Intern from communicating with it directly.