1

We've recently switched to using headless Chrome with our Protractor tests. Everything works pretty well except while testing system modals. Wondering if this is supported running Chrome headless? And, if so, hoping someone has some insight as to why our tests timeout waiting for the system modal to appear. TIA!

Xvfb

Xvfb :0 -screen 0 800x600x16
xvfb-run node_modules/.bin/webdriver-manager start

Protractor config

exports.config = {
  seleniumAddress: 'http://localhost:4444/wd/hub',
  baseUrl: 'http://localhost/cdash/',
  capabilities: {
    browserName: 'chrome',
    chromeOptions: {
       args: [ "--headless", "--disable-gpu", "--window-size=800x600" ]
     }
  }
}

Protractor test 1

...
// This generates a confirmation dialog which we have to accept.
// Wait for it to appear.
browser.wait(protractor.ExpectedConditions.alertIsPresent(), 10000);

// Then switch to it & click on it.
browser.switchTo().alert().accept();
...

Selenium exception output

08:49:19.709 INFO - Executing: [get alert text])
08:49:19.711 WARN - Exception thrown
org.openqa.selenium.NoAlertPresentException: no alert open
  (Session info: headless chrome=59.0.3071.115)
  (Driver info: chromedriver=2.30.477690 (c53f4ad87510ee97b5c3425a14c0e79780cdf262),platform=Mac OS X 10.12.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 2 milliseconds
Build info: version: '2.47.1', revision: '411b314', time: '2015-07-30 03:03:16'
System info: host: 'bryons-mbp.domain.tld', ip: 'x.x.x.x', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.12.5', java.version: '1.8.0_121'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.30.477690 (c53f4ad87510ee97b5c3425a14c0e79780cdf262), userDataDir=/var/folders/tq/b216ws_s64x2g2dgm3_gf4340000gn/T/.org.chromium.Chromium.2uF8Pp}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=59.0.3071.115, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]

Protractor output (via ctest)

116:   1) manageBuildGroup can delete buildgroups
116:    Message:
116:      Error: Wait timed out after 1008ms
116:    Stacktrace:
116:      Error: Wait timed out after 1008ms
116:     at Array.forEach (native)
116:     at process._tickCallback (internal/process/next_tick.js:103:7)
bryonbean
  • 173
  • 1
  • 11
  • Try removing the `--headless` arg, and adding a `browser.pause()` to see if the modal it's working correctly. You shouldn't be using xfbv if you are running headless chrome. – Alfonso MM Jul 21 '17 at 07:02
  • Agreed with your comment about headless chrome and xvfb, however until chromedriver 2.31 is released with we're stuck with that setup. https://stackoverflow.com/questions/44194088/protractor-throws-error-an-x-display-is-required-for-headless-chrome-59 – bryonbean Jul 21 '17 at 16:37
  • Personally i've used a pre-build that a user manage to deploy with 2.31 config that solves the problem. Here you go: https://tobiazure.blob.core.windows.net/files/chromedriver.zip – Alfonso MM Jul 27 '17 at 05:00

0 Answers0