nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.79k stars 1.31k forks source link

Selenium Error with saveScreenshot() #1484

Closed straris closed 7 years ago

straris commented 7 years ago

While the screenshots after a test failure are fine, the files resulting from saveScreenshot are unreadable.

Running verbose reveals the following error:

ERROR Response 500 GET /wd/hub/session/a44f7e69-fcc7-47ef-a747-5fb9c61f5b79/screenshot (10154ms) { state: 'unknown error',
  sessionId: 'a44f7e69-fcc7-47ef-a747-5fb9c61f5b79',
  hCode: 873945648,
  value: 
   { additionalInformation: '\nDriver info: org.openqa.selenium.chrome.ChromeDriver\nCapabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9), userDataDir=/var/folders/73/psty_mh539s681w32bfxr_3r0000gp/T/.org.chromium.Chromium.QYAZPG}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]\nSession ID: 668a9739552588533cec7a6a0ccc1eff',
     localizedMessage: 'unknown error: cannot get automation extension\nfrom unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html\n  (Session info: chrome=58.0.3029.110)\n  (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Mac OS X 10.11.3 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 10.11 seconds\nBuild info: version: \'3.4.0\', revision: \'unknown\', time: \'unknown\'\nSystem info: host: \'ip-10-102-12-30.eu-west-1.compute.internal\', ip: \'10.102.12.30\', os.name: \'Mac OS X\', os.arch: \'x86_64\', os.version: \'10.11.3\', java.version: \'1.8.0_73\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver\nCapabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9), userDataDir=/var/folders/73/psty_mh539s681w32bfxr_3r0000gp/T/.org.chromium.Chromium.QYAZPG}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]\nSession ID: 668a9739552588533cec7a6a0ccc1eff',
     systemInformation: 'System info: host: \'ip-10-102-12-30.eu-west-1.compute.internal\', ip: \'10.102.12.30\', os.name: \'Mac OS X\', os.arch: \'x86_64\', os.version: \'10.11.3\', java.version: \'1.8.0_73\'',
     supportUrl: null,
     cause: null,
     suppressed: [],
     message: 'unknown error: cannot get automation extension\nfrom unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html\n  (Session info: chrome=58.0.3029.110)\n  (Driver info: chromedriver=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9),platform=Mac OS X 10.11.3 x86_64) (WARNING: The server did not provide any stacktrace information)\nCommand duration or timeout: 10.11 seconds\nBuild info: version: \'3.4.0\', revision: \'unknown\', time: \'unknown\'\nSystem info: host: \'ip-10-102-12-30.eu-west-1.compute.internal\', ip: \'10.102.12.30\', os.name: \'Mac OS X\', os.arch: \'x86_64\', os.version: \'10.11.3\', java.version: \'1.8.0_73\'\nDriver info: org.openqa.selenium.chrome.ChromeDriver\nCapabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.27.440174 (e97a722caafc2d3a8b807ee115bfb307f7d2cfd9), userDataDir=/var/folders/73/psty_mh539s681w32bfxr_3r0000gp/T/.org.chromium.Chromium.QYAZPG}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=58.0.3029.110, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true, unexpectedAlertBehaviour=}]\nSession ID: 668a9739552588533cec7a6a0ccc1eff',
     hCode: 628531908,
     class: 'org.openqa.selenium.WebDriverException',
     buildInformation: 
      { buildRevision: 'unknown',
        buildTime: 'unknown',
        releaseLabel: '3.4.0',
        hCode: 802590952,
        class: 'org.openqa.selenium.internal.BuildInfo' },
     screen: null },
  class: 'org.openqa.selenium.remote.Response',
  status: 13 }

Simple test:

 browser
        .url('http://nightwatchjs.org/')
        .useCss().waitForElementVisible('body', 1000)
        .saveScreenshot('screenCompare/screens/test.png');
straris commented 7 years ago

Looks like it's a chromedriver issue, geckodriver works fine.