angular / protractor

E2E test framework for Angular apps
http://www.protractortest.org
MIT License
8.75k stars 2.31k forks source link

Protractor.Key.Enter is not working in ChromeDriver v75.0.3770.8 #5274

Open kiran333 opened 5 years ago

kiran333 commented 5 years ago

Hi,

Hope someone can help me looking into this issue. I updated my chromedriver to the latest version i.e. v75.0.3770.8, my regression tests started failing since then.

See the error message below

Failed: sendKeysToActiveElement
    Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53'
    System info: host: '***', ip: '172.*.*.*', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
    Driver info: driver.version: unknown

I usually use the command below to to perform RETURN(ENTER) on keyboard. browser.actions().sendKeys(protractor.Key.ENTER).perform();

I reverted back to chrome v74.0.3729.6 and it's all working fine

Thanks

Bug report

var PrettyReporter = require('../Dependencies/protractor-plugins/protractor-reporter-2').Reporter;
var env = require('../Scripts/Common/rigSelection.json');
var log4js = require('log4js');
var date = require('../Scripts/Common/UTC_DateFunctions.js')
var JasmineReporters = require('jasmine-reporters');
var UTC_DateFunctions_currentDate = date.get_Current_Date();
var UTC_DateFunctions_currentTime = date.currentTimeIncludingSeconds();
var currentTime_And_Date = UTC_DateFunctions_currentDate + '_' + UTC_DateFunctions_currentTime;

exports.config = {
  framework: 'jasmine',
  seleniumAddress: 'http://localhost:4444/wd/hub',
  rootElement: '.ng-app',
  suites: {
    Commands: './UTC/Verify_Command.js',

  },

  jasmineNodeOpts: {
    showColours: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 240000
  },

  beforeLaunch: function () {
    var currentTime_And_Date_log = UTC_DateFunctions_currentDate + '_' + UTC_DateFunctions_currentTime + '.log';
    var fileLocation = '../logs/';

    log4js.configure({
      appenders: {
        fileLog: { type: 'file', filename: fileLocation + currentTime_And_Date_log },
        console: { type: 'log4js-protractor-appender' },
      },
      categories: {
        file: { appenders: ['fileLog'], level: 'debug' },
        another: { appenders: ['console'], level: 'debug' },
        default: { appenders: ['console', 'fileLog'], level: 'trace' }
      }
    });
  },

  onPrepare: function () {
    browser.manage().timeouts().implicitlyWait(20000);
    browser.manage().window().maximize();
    console.log('************Setting all the infrastructure to run the tests****************');
    browser.ignoreSynchronization = false;
    browser.get(env.rig.UTC);
    browser.logger = log4js.getLogger('protractorLog4js');

    var ReportFileLocation = '../Reports/TestID_' + browser.params.env.testactivityId;
    var prettyReporter = new PrettyReporter({
      path: ReportFileLocation,
      screenshotOnPassed: false,
      project: browser.params.env.project,
      rigURL: browser.params.env.rigURL
    });
    browser.params.prettyReporter = prettyReporter;
    jasmine.getEnv().addReporter(prettyReporter);
  },

  capabilities: {
    browserName: 'chrome',
  },

  baseUrl: '',
  params: {
    env: {
      rig: 'default',
      tenant: 'default',
      filter: 'NO',
      testactivityId: currentTime_And_Date,
      rigUser: '',
      rigPass: '',
      project: 'UTC',
      module: '',
      moduleVersion: '',
      rwwDataFile: '',
      alertpath: '',
      rigURL: 'https://localhost/utc'
    }
  }
};

1 spec, 1 failure Finished in 71.593 seconds

JosephBittman commented 5 years ago

My understanding is that call is part of this rewrite.

https://chromedriver.storage.googleapis.com/76.0.3809.12/notes.txt

----------ChromeDriver 76.0.3809.12 (2019-06-07)---------- Supports Chrome version 76 Resolved issue 1897: Implement Actions API [Pri-1]

https://bugs.chromium.org/p/chromedriver/issues/detail?id=1897

kiran333 commented 5 years ago

My understanding is that call is part of this rewrite.

https://chromedriver.storage.googleapis.com/76.0.3809.12/notes.txt

----------ChromeDriver 76.0.3809.12 (2019-06-07)---------- Supports Chrome version 76 Resolved issue 1897: Implement Actions API [Pri-1]

https://bugs.chromium.org/p/chromedriver/issues/detail?id=1897

Hi Joseph,

Tested in Chrome Version v76.0.3809.100 and Chromedriver v76.0.3809.12. It still complaining about UnsupportedOperationError. Please see the stracktrace below

Failed: sendKeysToActiveElement Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: '****', ip: '10.0.75.1', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201' Driver info: driver.version: unknown Stack: UnsupportedOperationError: sendKeysToActiveElement Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:25:53' System info: host: '****', ip: '10.0.*.*', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201' Driver info: driver.version: unknown at Object.checkLegacyResponse (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\error.js:546:15) at parseHttpResponse (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:509:13) at doSend.then.response (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\http.js:441:30) at process._tickCallback (internal/process/next_tick.js:68:7) From: Task: sendKeys at thenableWebDriverProxy.schedule (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\webdriver.js:807:17) at actions.map.action (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\actions.js:124:23) at Array.map (<anonymous>) at C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\actions.js:123:29 at TaskQueue.execute_ (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14) at TaskQueue.executeNext_ (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27) at asyncRun (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2927:27) at C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:668:7 at process._tickCallback (internal/process/next_tick.js:68:7) From: Task: ActionSequence.perform at ActionSequence.perform (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\actions.js:122:33) at UserContext.<anonymous> (C:\workspace\Selenium Scripts\Scripts\UTC\Verify_LSTS_Command.js:36:58) at C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:112:25 at new ManagedPromise (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1077:7) at ControlFlow.promise (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2505:12) at schedulerExecute (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:95:18) at TaskQueue.execute_ (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3084:14) at TaskQueue.executeNext_ (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:3067:27) at asyncRun (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2974:25) at C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:668:7 From: Task: Run it("Verify LSTS command on a junction") in control flow at UserContext.<anonymous> (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:94:19) at C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:64:48 at ControlFlow.emit (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\events.js:62:21) at ControlFlow.shutdown_ (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2674:10) at shutdownTask_.MicroTask (C:\Users\kiran333\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2599:53) From asynchronous test:

paragraff commented 5 years ago

It seems bug fixed in chromedriver 77.0.3865.10:

Resolved issue 2975: Webdriver Actions for keys (CONTROL, SHIFT etc..) not working in ChromeDriver 75.0.3770.8 [Pri-2]
Resolved issue 2981: Chromedriver in W3C mode loses mouse state between Actions API calls [Pri-2]
jmutidjo commented 5 years ago

I'm also running into this issue on Chrome 76 for browser.actions().sendKeys(protractor.Key.TAB).perform(); and all keystrokes. I hope this is indeed fixed in Chrome 77. From what I see v.77 will be released September 10, 2019.

paragraff commented 5 years ago

I use workaround below. Download Chromium 74 version instructions. In protractor.conf.js in capabilities specify Chromium binary:

...
{
        browserName: 'chrome',
        maxInstances: 4,
    shardTestFiles: true,
    chromeOptions: {
                 ...
                //your path to Chromium
        binary: '/Applications/Chromium.app/Contents/MacOS/Chromium', 
        args: ["--headless", "--disable-gpu", "--window-size=1024,768"]
    }
}
...

that's all. My tests work again! BTW it's time to use browserless decisions like that: https://hub.docker.com/r/browserless/chrome/#docker

kiran333 commented 5 years ago

I use workaround below. Download Chromium 74 version instructions. In protractor.conf.js in capabilities specify Chromium binary:

...
{
        browserName: 'chrome',
        maxInstances: 4,
  shardTestFiles: true,
  chromeOptions: {
                 ...
                //your path to Chromium
      binary: '/Applications/Chromium.app/Contents/MacOS/Chromium', 
      args: ["--headless", "--disable-gpu", "--window-size=1024,768"]
  }
}
...

that's all. My tests work again! BTW it's time to use browserless decisions like that: https://hub.docker.com/r/browserless/chrome/#docker

Hi Paragraff,

Thats's what I did. I downgraded my chrome version to 74 and it started working again.

harsha509 commented 5 years ago

Hi @kiran333 , @jmutidjo

enabling the below capability enables chrome 74+ to use legacy API. Please try it works.

'goog:chromeOptions': { w3c: false }

Thanks !

jmutidjo commented 5 years ago

Appreciate the help @Harsha509

elnazkhorsand commented 4 years ago

Hi everyone, I am using chrome 78, still getting this error: "Failed: sendKeysToActiveElement"

Is there any documentation for Errors on Protractor because I could not find any in their official website. Guys, would you please help me with this...

kiran333 commented 4 years ago

Hi All, I have been getting this error since v75 of chromedriver. Could someone please look into this

kiran333 commented 4 years ago

Hi everyone, I am using chrome 78, still getting this error: "Failed: sendKeysToActiveElement"

Is there any documentation for Errors on Protractor because I could not find any in their official website. Guys, would you please help me with this...

Hi elnazkhorsand, There is a quick workaround. Add below lines to your capabilities in config file.

'goog:chromeOptions': { w3c: false }

elnazkhorsand commented 4 years ago

Hi @kiran333 ,

Still it does not work. Did you fix your problem with this?

elnazkhorsand commented 4 years ago

Hi everyone,

My conclusion on this issue: I have searched a lot and asked the experts, unfortunately this problem still exists and we have to use the older versions and wait for their release.

kiran333 commented 4 years ago

Yeah.It worked for me, I am still using chrome v75 and chrome driver v75 though.

Sent from Yahoo Mail for iPhone

On Friday, October 4, 2019, 10:20, elnazkhorsand notifications@github.com wrote:

Hi everyone,

My conclusion on this issue: I have searched a lot and asked the experts, unfortunately this problem still exists and we have to use the older versions and wait for their release.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

elnazkhorsand commented 4 years ago

Hey @kiran333 ,

I am using v78 and I wrote the code in my configuration file like this:

`exports.config = {

seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['protocommerce.js'], capabilities:{'browserName':'chrome', 'goog:chromeOptions': { w3c: false }

    }

};`

Is yours like this? Thanks for your time in advanced.

kiran333 commented 4 years ago

Hey, I just tried this on chrome 77 and chromedriver 77. It worked. Your config seems fine to me.  Thanks 

Sent from Yahoo Mail for iPhone

On Friday, October 4, 2019, 11:26, elnazkhorsand notifications@github.com wrote:

Hey @kiran333 ,

I am using v78 and I wrote the code in my configuration file like this:

`exports.config = {

seleniumAddress: 'http://localhost:4444/wd/hub', specs: ['protocommerce.js'], capabilities:{'browserName':'chrome', 'goog:chromeOptions': { w3c: false } }

};`

Is yours like this? Thanks for your time in advanced.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

thangam105 commented 4 years ago

Getting error UnsupportedOperationError: sendKeysToActiveElement in Chrome 78 version

config.multiCapabilities.push({ 'browserName': 'chrome', 'goog:chromeOptions': { 'args': ['no-sandbox'], 'w3c': false } }); Please suggest how to resolve this issue

4Tel-SteveM commented 3 years ago

Hello, Have there been any updates to solve this? While w3c: false did fix it, w3c: false now causes .getAttribute() to fail. Naturally .getAttribute() failing has a far larger impact. Thanks