rochejul / gulp-angular-protractor

Gulp plugin to run protractor tests
MIT License
25 stars 25 forks source link

ChromeDriver unable to maximize to defined values. #40

Closed ayanmodak closed 7 years ago

ayanmodak commented 7 years ago

It seems the chromedriver downloaded by this module is not upto date. Following is not working

browser.driver.manage().window().setSize(1280, 780);

getting the error below. Though this method is working properly with protractor command and webdriver-manager's chromedriver.

E/launcher - WebDriverError: unknown error: cannot get automation extension
from unknown error: page could not be found: chrome-extension://aapnijgdinlhnhlmodcfapnahmbfebeb/_generated_background_page.html
  (Session info: chrome=57.0.2987.98)
  (Driver info: chromedriver=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1),platform=Mac OS X 10.11.5 x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 10.09 seconds
Build info: version: '2.53.1', revision: 'a36b8b1', time: '2016-06-30 17:37:03'
System info: host: 'Ayans-MacBook-Pro.local', ip: '10.221.5.127', os.name: 'Mac OS X', os.arch: 'x86_64', os.version: '10.11.5', java.version: '1.8.0_101'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.25.426935 (820a95b0b81d33e42712f9198c215f703412e1a1), userDataDir=/var/folders/_3/n14_hxp15tv6cs2rb040my4c0000gn/T/.org.chromium.Chromium.L9kbap}, takesHeapSnapshot=true, pageLoadStrategy=normal, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=57.0.2987.98, platform=MAC, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: df6ec0f40d7a92842d79adc06b70234b
    at WebDriverError (/Users/ayanmodak/Google Drive/Foghorn/FogHornGitHub_Repo/velui/development/node_modules/gulp-angular-protractor/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
rahulmr commented 7 years ago

Probably you should use a different way to set the size for chrome windows, I generally use capabilities args and also I always avoid using maximize in my scripts.

var Jasmine2HtmlReporter = require('protractor-jasmine2-html-reporter');
var basePath = __dirname + '/reports/';
exports.config = {
  params: {
    timeoutLogin: 10000,
    timeout : 60000,
    raceTimeOut : 3000
  },

  allScriptsTimeout: 60000,
  // The address of a running selenium server.
  seleniumAddress: 'http://localhost:4444/wd/hub',
  // Capabilities to be passed to the webdriver instance.
  capabilities: {
    'browserName': 'chrome',
    'logName': 'Chrome',
    'count': 1,
    'chromeOptions': {
      'args': ['incognito', '--lang=en', '--window-size=1366,768']
    }
  },
  framework: 'jasmine',
  // Spec patterns are relative to the current working directly when
  // protractor is called.
  specs: ['e2e/**/*.js'],
...
...
rochejul commented 7 years ago

Indeed @rahulmr

However, I think I will suggest a way to specify the expected version of protractor, as I have done for another project: https://github.com/rochejul/sequelize-mocking/issues/9

Regards

pkarny commented 7 years ago

@ayanmodak @rochejul I found that there is a second reason for that. My tests did fail in scenarios different than changing screen resolution.

The problem is that the current webdriver manager is still fetching 2.25 version of ChromeDriver as the most recent one. It does not support Chrome 57 (https://chromedriver.storage.googleapis.com/2.28/notes.txt)

The easiest solution for now is to set forced chromedriver versions in webDriver config, example below:

.pipe(gulpProtractorAngular({
           // ...
            'webDriverUpdate': {
                args: ['--versions.chrome', '2.28']
            },
            'webDriverStart': {
                args: ['--versions.chrome', '2.28']
            }
        }))

All credits for that hint should go to Michael Romanov who suggested that solution in SO answer: http://stackoverflow.com/a/42825715/243899

Regards Piotr

MARyan87-zz commented 7 years ago

@veritas I have been working through this same problem. I tried including this in my gulpfile but now it is complaining that chromedriver_2.28mac64.zip doesn't exist. Have you found a way around this? The problem I see is that even if i manually include this file, next time i install packages it will be overwritten.