Skip to content

Commit aa4d8ce

Browse files
committed
feat: Use headless Chrome instead of PhantomJS by default
BREAKING CHANGE: Use headless Chrome instead of PhantomJS by default.
1 parent a39f21c commit aa4d8ce

File tree

6 files changed

+922
-701
lines changed

6 files changed

+922
-701
lines changed

Gruntfile.js

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ module.exports = function (grunt) {
6565
options: {
6666
webdriver: {
6767
desiredCapabilities: {
68-
browserName: 'phantomjs'
68+
browserName: 'chrome',
69+
chromeOptions: {
70+
args: ['--headless']
71+
}
6972
}
7073
},
7174
snapshots: 'test/snapshots'
@@ -240,6 +243,7 @@ module.exports = function (grunt) {
240243
}
241244
},
242245
{
246+
click: 'input',
243247
keys: 'test',
244248
wait: function (browser) {
245249
return browser.getValue('input')
@@ -366,7 +370,10 @@ module.exports = function (grunt) {
366370
'invalid-file': {
367371
options: {
368372
browserCapabilities: {
369-
browserName: 'phantomjs'
373+
browserName: 'chrome',
374+
chromeOptions: {
375+
args: ['--headless']
376+
}
370377
},
371378
screenshots: 'test/screenshots',
372379
force: true
@@ -435,11 +442,13 @@ module.exports = function (grunt) {
435442
stopOnExit: true
436443
},
437444
server: {
438-
seleniumVersion: '3.7.1',
445+
seleniumVersion: '3.141.5',
439446
seleniumDownloadURL: 'http://selenium-release.storage.googleapis.com',
440447
drivers: {
441-
phantomjs: { // https://bitbucket.org/ariya/phantomjs/downloads/
442-
version: '2.1.1'
448+
chrome: {
449+
version: '71.0.3578.33',
450+
arch: process.arch,
451+
baseURL: 'https://chromedriver.storage.googleapis.com'
443452
}
444453
}
445454
}

README.md

Lines changed: 38 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,26 +110,25 @@ Chooses the web browser to take snapshots with, Selenium host and other paramete
110110
```js
111111
'selenium_standalone': {
112112
serverConfig: {
113-
seleniumVersion: '3.8.1', // 3.7.1 or older is needed for phantomjs
113+
seleniumVersion: '3.141.5', // 3.7.1 or older is needed for phantomjs
114114
seleniumDownloadURL: 'http://selenium-release.storage.googleapis.com',
115115
drivers: {
116-
// http://chromedriver.storage.googleapis.com/
117116
chrome: {
118-
version: '2.35',
117+
version: '71.0.3578.33',
119118
arch: process.arch,
120119
baseURL: 'https://chromedriver.storage.googleapis.com'
121120
},
122121
// https://developer.microsoft.com/en-us/microsoft-edge/tools/webdriver/
123122
edge: {
124-
version: '5.16299'
123+
version: '6.17134'
125124
},
126125
// https://github.com/mozilla/geckodriver/releases
127126
firefox: {
128-
version: '0.19.1'
127+
version: '0.23.0'
129128
},
130129
// https://selenium-release.storage.googleapis.com/
131130
ie: {
132-
version: '3.8.0',
131+
version: '3.9.0',
133132
arch: 'ia32'
134133
},
135134
// https://selenium-release.storage.googleapis.com/
@@ -507,6 +506,38 @@ $ npm install phantomjs-prebuilt --save-dev
507506
508507
The `phantomjs` binary will be accessible in `./node_modules/.bin`. If you do not start the Selenium server using `npm test` or other `npm run` command, you will had to add this directory to your `PATH`, otherwise the PhantomJS driver will not find the executable. Additionally, PhantomJS 2.1.1 works only with the Selenium driver version 3.7.1 or older.
509508
509+
If you want to test with a headless browser, you may want to prefer Chrome to PhantomJS. Chrome can run in the headless mode too and PhantomJS is not developed any more. The default configuration of this task will choose Chrome in the headless mode:
510+
511+
```js
512+
'html-dom-snapshot': {
513+
options: {
514+
webdriver: {
515+
desiredCapabilities: {
516+
browserName: 'chrome',
517+
chromeOptions: {
518+
args: ['--headless']
519+
}
520+
}
521+
}
522+
}
523+
}
524+
```
525+
526+
If you want to run Chrome in the windowed mode, override the `chromeOptions` object with yours, even an empty one, which is missing the `--headless` argument, for example:
527+
528+
```js
529+
'html-dom-snapshot': {
530+
options: {
531+
webdriver: {
532+
desiredCapabilities: {
533+
browserName: 'chrome',
534+
chromeOptions: {}
535+
}
536+
}
537+
}
538+
}
539+
```
540+
510541
## Contributing
511542
512543
In lieu of a formal styleguide, take care to maintain the existing coding
@@ -515,6 +546,7 @@ your code using Grunt.
515546
516547
## Release History
517548
549+
* 2018-11-26 [v2.0.0] Use headless Chrome instead of PhantomJS by default
518550
* 2018-05-14 [v1.3.0] Allow saving snapshots to sub-directories, file numbering per-directory, add `scroll` instruction
519551
* 2018-05-11 [v1.2.0] Introduce delay after every instruction to be able to visually follow the actions when debugging
520552
* 2018-03-29 [v1.1.0] Allow specifying all initialization parameters supported by WebdriverIO

0 commit comments

Comments
 (0)