Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
docs(phantomjs): Add deprecation notice for PhantomJS
Browse files Browse the repository at this point in the history
  • Loading branch information
heathkit committed May 4, 2017
1 parent 1250278 commit 160a04b
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions docs/browser-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,25 +118,23 @@ browser2.$('.css').click();

Setting up PhantomJS
--------------------
_Note: We recommend against using PhantomJS for tests with Protractor. There are many reported issues with PhantomJS crashing and behaving differently from real browsers._
PhantomJS is [no longer officially supported](https://groups.google.com/forum/#!topic/phantomjs/9aI5d-LDuNE). Instead, we recommend either [running Chrome in Xvfb](http://www.tothenew.com/blog/protractor-with-jenkins-and-headless-chrome-xvfb-setup/) or using Chrome's [headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome).

In order to test locally with [PhantomJS](http://phantomjs.org/), you'll need to either have it installed globally, or relative to your project. For global install see the [PhantomJS download page](http://phantomjs.org/download.html). For local install run: `npm install phantomjs`.

Add phantomjs to the driver capabilities, and include a path to the binary if using local installation:
Using headless Chrome
---------------------
To start Chrome in headless mode, start Chrome with the `--headless` flag.

As of Chrome 58 you also need to set `--disable-gpu`, though this may change in future versions.
Also, changing the window size during a test will not work in headless mode, but you can set it
on the commandline like this `--window-size=800,600`.

```javascript
capabilities: {
'browserName': 'phantomjs',

/*
* Can be used to specify the phantomjs binary path.
* This can generally be ommitted if you installed phantomjs globally.
*/
'phantomjs.binary.path': require('phantomjs-prebuilt').path,

/*
* Command line args to pass to ghostdriver, phantomjs's browser driver.
* See https://github.com/detro/ghostdriver#faq
*/
'phantomjs.ghostdriver.cli.args': ['--loglevel=DEBUG']
browserName: 'chrome',

chromeOptions: {
args: [ "--headless", "--disable-gpu", "--window-size=800x600" ]
}
}
```

0 comments on commit 160a04b

Please sign in to comment.