Chrome 59 introduced an headless mode, in this mode it does not need any
DISPLAY (Xorg, Xvfb...). That achieved by passing to chrome:
--headless
Use headless when DISPLAY is not available. One can switch to headless
by simply unsetting the environment variable: unset(DISPLAY).
Bug: T167507
Signed-off-by: Antoine Musso <hashar@free.fr>
Change-Id: Id5424eafb20112fd74d472b8cef02cb15cafff89
npm run selenium
+By default, Chrome will run in headless mode. If you want to see Chrome, set DISPLAY
+environment variable to any value:
+
+ DISPLAY=:1 npm run selenium
+
To run only one file (for example page.js), you first need to spawn the chromedriver:
chromedriver --url-base=wd/hub --port=4444
maxInstances: 1,
//
browserName: 'chrome',
- // Since Chrome v57 https://bugs.chromium.org/p/chromedriver/issues/detail?id=1625
chromeOptions: {
- args: [ '--enable-automation' ]
+ // Run headless when there is no DISPLAY
+ // --headless: since Chrome 59 https://chromium.googlesource.com/chromium/src/+/59.0.3030.0/headless/README.md
+ args: process.env.DISPLAY ? [] : [ '--headless' ]
}
} ],
//