protractor: Failed: sendKeysToActiveElement

Hi there!

Thanks for submitting an issue to Protractor.

To help us help you better, please do the following before submitting an issue:

  1. Review the questions section of CONTRIBUTING.md.
  2. Make sure you are not asking a usage or debugging question. If you are, use StackOverflow, Google Group discussion list, or Gitter to get help.
  3. Provide a minimally reduced test case. This makes it much more likely that your bug will be fixed. Protractor has a test Angular application available at http://www.protractortest.org/testapp which you can use for the reproducible test case.
  4. Fill in the information that corresponds to your type of issue below.
  5. Delete this intro and any unrelated text 😄 (if you do not we’ll assume you haven’t read these instructions and automatically close the issue.)

Bug report

  • Node Version: ``
  • Protractor Version: ``
  • Angular Version: ``
  • Browser(s): ``
  • Operating System and Version ``
  • Your protractor configuration file
  • A relevant example test
  • Output from running the test
  • Steps to reproduce the bug
  • The URL you are running your tests against (if relevant)

Feature Request Stack: UnsupportedOperationError: sendKeysToActiveElement Build info: version: ‘3.141.59’, revision: ‘e82be7d358’, time: ‘2018-11-14T08:25:53’ System info: host: ‘EPL-80’, ip: ‘192.168.5.88’, os.name: ‘Windows 10’, os.arch: ‘amd64’, os.version: ‘10.0’, java.version: ‘1.8.0_181’ Driver info: driver.version: unknown at Object.checkLegacyResponse (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\error.js:546:15) at parseHttpResponse (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\http.js:509:13) at doSend.then.response (E:\js\Easypolicy\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 (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\webdriver.js:807:17) at actions.map.action (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\actions.js:124:23) at Array.map (<anonymous>) at E:\js\Easypolicy\node_modules\selenium-webdriver\lib\actions.js:123:29 at TaskQueue.execute (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:3084:14) at TaskQueue.executeNext_ (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:3067:27) at asyncRun (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:2927:27) at E:\js\Easypolicy\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 (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\actions.js:122:33) at UserContext.<anonymous> (E:\js\Easypolicy\Hdfc.js:23:58) at E:\js\Easypolicy\node_modules\jasminewd2\index.js:112:25 at new ManagedPromise (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:1077:7) at ControlFlow.promise (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:2505:12) at schedulerExecute (E:\js\Easypolicy\node_modules\jasminewd2\index.js:95:18) at TaskQueue.execute (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:3084:14) at TaskQueue.executeNext_ (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:3067:27) at asyncRun (E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:2927:27) at E:\js\Easypolicy\node_modules\selenium-webdriver\lib\promise.js:668:7 From: Task: Run it(“HDFC Proposal Journey”) in control flow at UserContext.<anonymous> (E:\js\Easypolicy\node_modules\jasminewd2\index.js:94:19) From asynchronous test: Error at Suite.<anonymous> (E:\js\Easypolicy\Hdfc.js:4:2) at Object.<anonymous> (E:\js\Easypolicy\Hdfc.js:1:63) at Module._compile (internal/modules/cjs/loader.js:701:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:712:10) at Module.load (internal/modules/cjs/loader.js:600:32) at tryModuleLoad (internal/modules/cjs/loader.js:539:12)


  • Reasons for adopting new feature
  • Is this a breaking change? (How will this affect existing functionality)

About this issue

Most upvoted comments

Try disabling w3c which is default set to true starting Chrome 75

‘goog:chromeOptions’: { w3c: false }

hi @Panier,

Thanks @vsravuri for the solution.

Yes, enabling the below capability enables chrome to use legacy API. Please try it works. ‘goog:chromeOptions’: { w3c: false }

Thanks !

If in your case W3C disabling is not an option or doesn’t work, you can rewrite the function and use plain javascript :

static async getInputValue(elementFinder: ElementFinder): Promise<string> {
        return browser.executeScript(`return arguments[0].value`, elementFinder);
}

Not the best option I know…

You may have used also textToBePresentInElementValue in this case:

import { falseIfMissing } from 'protractor/built/util';

private static textToBePresentInElementValue(elementFinder: ElementFinder, text: string) {
    let hasText = async () => {
        return browser.executeScript(`return arguments[0].value`, elementFinder).then((actualText: string) => {
            return actualText.indexOf(text) > -1;
        }, falseIfMissing);
    };
    return protractor.ExpectedConditions.and(protractor.ExpectedConditions.presenceOf(elementFinder), hasText);
}

Looks it could be a big problem in the nearest future. @angular team, @kyliau Could you please look at this? With release of chrome 91 we will have broken Protractor tests.

Can you reanimate Protractor v6 or something with Selenium 4 treatment? Please don;t ignore community.