-
Notifications
You must be signed in to change notification settings - Fork 675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: supported switching to iframes that are places in a Shadow Root #7139
Conversation
src/client/core/utils/dom.js
Outdated
export function findIframeByWindow (iframeWindow) { | ||
const iframes = []; | ||
|
||
document.querySelectorAll('*').forEach(elem => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the native methods from the hammerhead.nativeMethods
for querySelector, querySelectorAll functions.
Consider using the find method from hammerhead here.
if (elem.tagName === 'IFRAME') | ||
iframes.push(elem); | ||
|
||
if (elem.shadowRoot) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid using the the forEach
method here. It can be overridden and it's not cross-browser code (we are still supporting IE).
@@ -52,6 +52,21 @@ test('Click on element in a nested iframe', async t => { | |||
expect(iframeBtnClickCount).eql(1); | |||
}); | |||
|
|||
test.page`http://localhost:3000/fixtures/api/es-next/iframe-switching/pages/shadow.html` | |||
('Click on an element in a shadow iframe and return to the main window', async t => { | |||
await t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a test for the case with nested shadow roots with iframes:
- element
- shadowRoot
- iframe
- element
- shadowRoot
- iframe
- shadowRoot
- element
- iframe
- shadowRoot
Release v1.20.1-rc.1 addresses this. |
[closes #3673]
Purpose
Support switching to Iframes that are places in a Shadow Root
Approach
driverIframe
in the DOM for instancesChildIframeDriverLink
References
#3673
Pre-Merge TODO