getAttribute("value") doesn't work with driver 91.0.4472.19 and Chrome 91.0.4472.77
Asked Answered
B

5

8

After Chrome and driver update to 91th version I found the VBA macro with driver 91.0.4472.19 (win32) become return empty string ("") from input tag 'value' attribute:

Dim ch As SeleniumWrapper.WebDriver
Dim el As WebElement
' some code here ...
ch.findElementById("htmlLoginId").SendKeys login
Set el = ch.findElementById("htmlLoginId")
txt = el.getAttribute("value")

With older driver version 90.0.4430.24 this works fine. Hope it will be fixed in next driver versions.

Is there another way to get value from input[type=text] tag? I want to avoid situation if this bug will not be fixed in 92th version and 90th driver version become incompatible.

Beshore answered 1/6, 2021 at 8:9 Comment(2)
What is the actual question?Corneille
Is there another way to get value from input[type=text] tag? I want to avoid situation if this bug will not be fixed in 92th version and 90th driver version become incompatible.Beshore
S
2

We have been fighting with this issue a couple of days since the new chrome driver came out. A workaround we did was to bypass calls to the webdriver's getAttribute method if we want to retrieve properties (that are not html attributes) of the element and instead use the following custom script:

browser.executeScript(`return arguments[0].${this.textAttribute}`, el);

The above example is valid for protractor, which is what we are using. If your stack is different, you need to call the appropriate alternative to browser.executeScript, but the script itself would be quite the same.

Stoichiometric answered 2/6, 2021 at 12:11 Comment(1)
This seems to work with protractor but feels kind of hacky. Thanks for sharing Ivaylo!Disincline
D
1

We did it!

ARG CHROME_VERSION="90.0.4430.212-1"
RUN wget --no-verbose -O /tmp/chrome.deb https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  && apt install -y /tmp/chrome.deb \
  && rm /tmp/chrome.deb
./webdriver-manager update --versions.chrome 90.0.4430.24
Delvecchio answered 2/6, 2021 at 12:10 Comment(0)
T
1

This was a regression in chrome driver 91. A fix has been made. Hopefully an updated v91 chrome driver will be released soon.

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

In the meantime we are using chrome driver 90.

Thirzia answered 2/6, 2021 at 16:55 Comment(0)
N
0

I am reproducing this doing getAttribute('innerHTML') as well. As another workaround, run tests with Firefox instead of Chrome

Naples answered 2/6, 2021 at 18:21 Comment(0)
C
0

We are also facing the similar issue while getting attribute data of an element using GetAttribute() of web element in C#. Struggled two days to find out what the root cause is. And for us it is not possible to make workarounds as code base is already frozen. Waiting for the fix. And as per the issue https://bugs.chromium.org/p/chromium/issues/detail?id=1205107 it may take couple of weeks to release another version with fix.

The issue has been fixed with the new release of ChromeDriver 91.0.4472.101 and ChromeDriver 92.0.4515.43

Changsha answered 10/6, 2021 at 18:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.