Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Chrome 91 will break more Protractor tests #5519

Closed
StanislavKharchenko opened this issue May 27, 2021 · 17 comments
Closed

Chrome 91 will break more Protractor tests #5519

StanislavKharchenko opened this issue May 27, 2021 · 17 comments

Comments

@StanislavKharchenko
Copy link

Bug report

  • Node Version: 14.17.0
  • Protractor Version: 7.0.0
  • Browser(s): Chrome v91
  • Operating System and Version Windows 10

The issue started to reproduce with the release of chromedriver v91.
https://bugs.chromium.org/p/chromium/issues/detail?id=1205107&start=300

Method getAttribute will always return null within usage of older JWP (w3c: false).
From another side, with the w3c: true on legacy Selenium 3 - browser actions are not working due to incompatibility.

So the recommendation is to upgrade with selenium-webdriver 4.0 where full support of w3c implemented.

I have added a PR where made upgrades with the latest selenium 4.0

@kunaly1038
Copy link

Node Version: 14.17.0
Protractor Version: 7.0.0
Browser(s): Chrome v91
Operating System and Version Windows 10

DevTools listening on ws://127.0.0.1:50372/devtools/browser/f2d2213a-b6e6-4f59-8534-d7c75a6d99d9
[10128:9592:0603/130716.699:ERROR:device_event_log_impl.cc(214)] [13:07:16.699] Bluetooth: bluetooth_adapter_winrt.cc:1072 Getting Default Adapter failed.
Started
[2021-06-03T13:07:23.632] [INFO] AutomationTest - login into application if user not login
[3668:11396:0603/130914.803:ERROR:gpu_init.cc(440)] Passthrough is not supported, GL is disabled
[2021-06-03T13:10:01.182] [INFO] AutomationTest - Go to data entity management page
[2021-06-03T13:10:12.034] [INFO] AutomationTest - created new data browser entity CGFParameter1622705841541
(node:6012) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'trim' of null
at Function. (D:\aca2\ims-web-ui-testing\e2e-tests\e2e\components\html\element-helper.ts:210:37)
at Generator.next ()
at fulfilled (D:\aca2\ims-web-ui-testing\e2e-tests\temp\e2e\components\html\element-helper.js:5:58)
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use node --trace-warnings ... to show where the warning was created)
(node:6012) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag --unhandled-rejections=strict (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:6012) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Getting this error when updating the chrome to 91 version else this issue is working fine on 90 version of chrome.

@hosuaby
Copy link

hosuaby commented Jun 3, 2021

I confirm that element.getAttribute('value') where element is an <input> always returns null when used with chromedriver=91.0.4472.19 (chrome=91.0.4472.77).

Perhaps, element.getAttribute('id') or element.getAttribute('class') are working fine.

It's possible to use this hack to get the value of the <input> while waiting for the fix:

browser.executeScript(``return document.getElementById("${id}").value``)

@hugodes
Copy link

hugodes commented Jun 3, 2021

I can also confirm. I know this is just saying +1, but if we could get the attention of some of the Angular team, it'd be great.
Our whole CI/CD pipline is in shatters because of this.

@matjoh
Copy link

matjoh commented Jun 3, 2021

The last chromedriver that worked with getAttribute("value") was version 90.0.4430.24.

Until chromedriver gets patched (which seems like it will be according to this thread posted by @StanislavKharchenko) we use this fix in our ci pipeline to use that version run our angular protractor tests.

This is what out pipline looked like before:

Setup:
    npm install
    node ./node_modules/.bin/webdriver-manager update
Script:
    ng e2e --protractorConfig=./path/to/protractor/config.js

This is what it looks like after:

Setup:
    npm install
    node ./node_modules/.bin/webdriver-manager update --versions.chrome=90.0.4430.24
Script:
    ng e2e --protractorConfig=./path/to/protractor/config.js --webdriver-update false

Good luck!

@kunaly1038
Copy link

I confirm that element.getAttribute('value') where element is an <input> always returns null when used with chromedriver=91.0.4472.19 (chrome=91.0.4472.77).

Perhaps, element.getAttribute('id') or element.getAttribute('class') are working fine.

It's possible to use this hack to get the value of the <input> while waiting for the fix:

browser.executeScript(return document.getElementById("${id}").value)

Using class but still unable to get the value. Tried with id also but not working.

@RaphL
Copy link

RaphL commented Jun 4, 2021

The matjoh's temporary workaround is working for me. Thanks

jan-molak added a commit to serenity-js/serenity-js that referenced this issue Jun 6, 2021
ChromeDriver 91 introduced a breaking change that makes GetElementAttribute command return `null`
instead of the actual attribute value.

This change works around this issue by making Serenity/JS automatically fall back to retrieving
the attribute value using injected JavaScript should WebElement.getAttribute(name) return `null`.

References:
- https://bugs.chromium.org/p/chromium/issues/detail?id=1205107&start=300
- angular/protractor#5519
@copaste
Copy link

copaste commented Jun 7, 2021

I also confirm that element.getAttribute('value') where element is input or textarea always returns null when used with chromedriver=91.0.4472.19 (chrome=91.0.4472.77).
Also element.clear() doesn't work anymore.

Workarounds:

// getAttribute('value')
async getValue(elem: ElementFinder): Promise<string> {
    return browser.executeScript(
        'return arguments[0].value',
        await elem.getWebElement()
    );
}
    
// clear();
async clearInput(elem: ElementFinder): Promise<string> {
  return elem.sendKeys(
      protractor.Key.chord(protractor.Key.CONTROL, 'A'), // Linux, Windows
      protractor.Key.chord(protractor.Key.COMMAND, 'A'), // macOS
      protractor.Key.BACK_SPACE
  );
}

@jan-molak
Copy link
Contributor

jan-molak commented Jun 9, 2021

I've described the problem and possible solutions in this article.

Also, for Serenity/JS developers reading this thread - @serenity-js/protractor version 2.29.0 introduces support for Chrome 91, so upgrading the framework to the latest version will resolve the problem.

Learn more: Serenity/JS website and API docs, template projects for Protractor, community chat.

@evilaliv3
Copy link
Contributor

evilaliv3 commented Jun 14, 2021

This seems to be related to #5522

I was actually verifying the error with getAttribute('value') on firefox but from this ticket i understand the error is more broad.

what do you think?

evilaliv3 added a commit to globaleaks/globaleaks-whistleblowing-software that referenced this issue Jun 14, 2021
@StanislavKharchenko
Copy link
Author

@evilaliv3 Thanks for posting that!
Looks like the firefox was the next. However, I see that chromium fixed this. I'm not checked yet, since in our team we migrated to my fork Protractor v6 with selenium 4.0 and all is fine.

@angular team, @kyliau, @Splaktar Could you please give to community some info about upgrades to selenium 4.0? I've added a PR, but any activities are stalled again :(

@navix
Copy link

navix commented Jun 17, 2021

If you have no ability to fix the environment, you can take value on passed element using executeScript:

function getVal(el: ElementFinder) {
  const f = (arg) => arg.value;
  return browser.executeScript(f, el);
}

@StanislavKharchenko
Copy link
Author

@navix This is a bad practice to execute js code directly to invoke value from.
I know that this is just workaround, but the solution should be stable and provided officially by maintainer.

@kyliau @IgorMinar @Splaktar ping! Please say smth.

@navix
Copy link

navix commented Jun 17, 2021

I know that this is just workaround.

That. I do not have any joy of using it, but at this stage it can be useful.
Considering decision to deprecate Protractor from Angular, it is hard to predict estimates to quality fixes.

@StanislavKharchenko
Copy link
Author

@navix There was a decision to continue Protractor as v6 without control flow.
That's why this issue was registered and PR added.
For now the master branch reflects v6. The next step should merge PR and release.

evilaliv3 added a commit to globaleaks/globaleaks-whistleblowing-software that referenced this issue Jul 27, 2021
evilaliv3 added a commit to globaleaks/globaleaks-whistleblowing-software that referenced this issue Jul 27, 2021
evilaliv3 added a commit to globaleaks/globaleaks-whistleblowing-software that referenced this issue Jul 27, 2021
evilaliv3 added a commit to globaleaks/globaleaks-whistleblowing-software that referenced this issue Jul 27, 2021
evilaliv3 added a commit to globaleaks/globaleaks-whistleblowing-software that referenced this issue Jul 27, 2021
@devversion
Copy link
Member

FYI: Chromium fixed the compatibility issue for the JWP legacy mode. See: https://chromium-review.googlesource.com/c/chromium/src/+/2931437.

The fix is available in the latest Chromium development version, and has also been cherry-picked back into M91 and M92.

Given that this was a bug within Chromium, I don't think there is any action for Protractor here. It's reasonable to say that Protractor, if it would be W3C compliant, wouldn't have hit this bug. Though, making Protractor W3C compliant seems like a different issue?

@StanislavKharchenko
Copy link
Author

@devversion Given that this issue tracked by chromium so much time we can’t allow such risks and switched to Protractor v6. We’re also not sure about next surprises with the legacy jwp. Also we don’t know how long browsers will support this protocol.
Could you please share information with community when we expect to got the next release of Protractor with new selenium?

@StanislavKharchenko
Copy link
Author

Closing this due to lack of activities from maintainers.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests