-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
Bug 🐛help wantedIssues that are free to take by anyone interestedIssues that are free to take by anyone interested
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.14.0
Node.js Version
22.13.1
Mode
WDIO Testrunner
Which capabilities are you using?
{
browserName: 'chrome',
},
{
browserName: 'firefox',
},What happened?
I created a repository where I reproduce wdio bugs: https://github.com/htho/wdio-repro-collection
I want to switchFrame to an iframe in a shadow dom. But it fails (see below)
What is your expected behavior?
It should be possible to switch to an iframe even if it is in a shadow root.
How to reproduce the bug.
I created a repository that I reuse to report bugs: https://github.com/htho/wdio-repro-collection
- git clone https://github.com/htho/wdio-repro-collection.git
- cd wdio-repro-collection
- npm ci
- npm run test:iframeInShadow
<!-- https://htho.github.io/wdio-repro-collection/iframeInShadow.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>IFrame in Shadow DOM</title>
</head>
<body>
<h1>IFrame in Shadow DOM</h1>
<div id="wrapper">
<template shadowrootmode="open">
<h2 id="headlineInShadow">Headline in Shadow Root</h2>
<iframe src="iframeTarget.html"></iframe>
</template>
</div>
</body>
</html><!-- https://htho.github.io/wdio-repro-collection/iframeTarget.html -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Iframe Target</title>
</head>
<body>
<h1>Iframe Target</h1>
</body>
</html>beforeEach(async () => {
await browser.url(`https://htho.github.io/wdio-repro-collection/iframeInShadow.html`)
});
describe('switchFrame to an iframe in the shadow dom', () => {
it(`works using a selector (fails in 9.14.0)`, async () => {
const $iframe = $("#wrapper").shadow$("iframe");
await expect($iframe).toExist();
// FAILS in chrome: WebDriver Bidi command "script.callFunction" failed with error: invalid argument - Invalid input in "arguments"/0.
// FAILS in firefox: WebDriver Bidi command "script.callFunction" failed with error: invalid argument - Expected "type" to be a string, got [object Undefined] undefined
await browser.switchFrame($iframe);
await expect($(`h1`)).toHaveText("Iframe Target");
});
it(`works using the url (fails in 9.14.0)`, async () => {
// FAILS: Frame with url or context id "https://htho.github.io/wdio-repro-collection/iframeTarget.html" not found, available frames to switch to: -
await browser.switchFrame("https://htho.github.io/wdio-repro-collection/iframeTarget.html");
await expect($(`h1`)).toHaveText("Iframe Target");
});
});Relevant log output
included as comment in the test file
Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Bug 🐛help wantedIssues that are free to take by anyone interestedIssues that are free to take by anyone interested