SeasideSt / Parasol

Testing web apps in Smalltalk using Selenium WebDriver.
MIT License
31 stars 16 forks source link

getAttribute: may return nil using chromedriver 91.0.4472.19 or 91.0.4472.101 while earlier versions returned a value #49

Closed jbrichau closed 3 years ago

jbrichau commented 3 years ago

Parasol is affected by a bug introduced in chromedriver 91.0.4472.19 :https://bugs.chromium.org/p/chromium/issues/detail?id=1205107 Although the issue is reportedly fixed in chromedriver 91.0.4472.101, the getAttribute: method still returns nil when trying to retrieve the value of an input field.

More context: https://janmolak.com/chrome-91-might-break-your-tests-507309b9b2cd

jbrichau commented 3 years ago

The problem had started popping up in the Seaside builds: https://github.com/SeasideSt/Seaside/runs/2814783250 For now, I disabled the tests that use getAttribute: until it gets fixed in Parasol / Chromedriver

jbrichau commented 3 years ago

The workaround using executeScript:with, which is essentially proposed by https://janmolak.com/chrome-91-might-break-your-tests-507309b9b2cd does not work for the attributes value and innerHTML (at least). You cannot get the value of an inputfield in Javascript using field.getAttribute('value') but rather through field.value.

In addition, the chromium team claims that the change only affects legacy mode and not the (default) w3c mode. This is clearly false for the above two usecases and there are other people reporting it. It's not clear to me at this point if they want to fix this or not but currently there is no way to get the value of an inputfield using ChromeDriver and Selenium 3, other than via Javascript. I don't know if Selenium 4 has support for it, nor how much work we have to upgrade to it.

jbrichau commented 3 years ago

Note that I tried running Parasol with Selenium 4.0.0-beta-4 and the same tests failed as Selenium 3. That's good and bad news. The good news is Parasol just works with Selenium 4 (as far as the test coverage is concerned) and the bad news is that Chromedriver really changed the meaning of getAttribute:.