google / google/webdriver.dart
Webdriver can't return shadowRoot (as SearchContext) in Chrome96+
- Dominant language
- Dart
- Stars
- 142
- Forks
- 49
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 4
Description
We're attempting to run some tests in Chrome96, and this bit of the code is failing:
https://github.com/flutter/flutter/blob/5e0cc4cba416866225821c0eaba581ac7c0a712c/examples/hello_world/test_driver/smoke_web_engine_test.dart#L46-L50
With the following error ([complete build](https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8820302907871290081/+/u/run_test.dart_for_web_long_running_tests_shard_and_subshard_5_5/test_stdout#L1003_35)):
```
type '_InternalLinkedHashMap' is not a subtype of type 'SearchContext?' in type cast
test_driver/smoke_web_engine_test.dart 50:9 main..
===== asynchronous gap ===========================
package:test_api/src/backend/declarer.dart 215:9 Declarer.test..
===== asynchronous gap ===========================
package:test_api/src/backend/declarer.dart 213:7 Declarer.test.
===== asynchronous gap ===========================
package:test_api/src/backend/invoker.dart 257:7 Invoker._waitForOutstandingCallbacks.
```
---
It seems that there has been a change in how Chrome 96+ retrieves the shadowRoot of an element.
* Chromedriver issue: https://bugs.chromium.org/p/chromedriver/issues/detail?id=3958
* Documentation + possible workaround: https://titusfortner.com/2021/11/22/shadow-dom-selenium.html
Looking at the equivalent [fix in Selenium](https://github.com/SeleniumHQ/selenium/commit/4e24e999b7f12510793e8bf515314bf2fa7ae5e8), it seems that some of the changes need to happen in `package:webdriver`?
---
Copied from https://github.com/flutter/flutter/issues/99775
Contributor guide
Assessment
This issue has not been assessed yet.