Closed StanislavKharchenko closed 3 years ago
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.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.
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``)
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.
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!
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')
orelement.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.
The matjoh's temporary workaround is working for me. Thanks
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
);
}
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.
This seems to be related to https://github.com/angular/protractor/issues/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 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 :(
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);
}
@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.
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.
@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.
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?
@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?
Closing this due to lack of activities from maintainers.
Bug report
14.17.0
7.0.0
Chrome v91
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