WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
287035
Web Inspector: SafariDriver: Elements added to an iframe, but created outside that iframe cannot be found by SafariDriver
https://bugs.webkit.org/show_bug.cgi?id=287035
Summary
Web Inspector: SafariDriver: Elements added to an iframe, but created outside...
Jack Wellborn
Reported
2025-02-04 12:02:41 PST
Created
attachment 474137
[details]
A shell script that runs SafariDriver commands to find the two elements. Hello, I got a nice juicy edge case for y'all that took me a while to narrow. Per the summary, elements added to an iframe that were created outside that iframe cannot be found by SafariDriver. Allow me to elaborate and give an example. Below is a link to test page has an iframe that contains two divs. Both divs were created in a JavaScript running in the top window and appended to the iframe's body. The difference is the one with the ID of "created-by-iframe-doc" was created with iframe's document (`iframe.contentDocument.createElement`) while the one with the ID "created-by-top-doc" was created by the top document (`document.createElement`). SafariDriver can see the element created by the iframe's document, but throws a 'no such element' error when trying to find the element created by the top document. Test Page:
https://jackwellborn.com/playground/safariDriverIframeBug/
Reproduction steps: 1. Start safaridriver on port 4444 (`safaridriver -p 4444`) 2. Open Safari 3. Open Terminal 4. In Terminal, navigate to and run the attached shell script. Expected result: Both element requests should return a value (e.g. {"value":{"element-6066-11e4-a52e-4f735466cecf":"node-1E22B301-C049-4694-9233-7CF4E0FECC7F"}}) Actual result: Finding the first element created using the iframe's document returns a value, but trying to find the second element created using the top document returns an error. Feel free to reach out if you have any questions and thanks for all the hard work.
Attachments
A shell script that runs SafariDriver commands to find the two elements.
(2.82 KB, application/x-sh)
2025-02-04 12:02 PST
,
Jack Wellborn
no flags
Details
The same script that runs safaridriver, but tries using JQ to parse out the session ID
(3.00 KB, application/x-sh)
2025-02-04 13:10 PST
,
Jack Wellborn
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Jack Wellborn
Comment 1
2025-02-04 12:23:23 PST
I should add that I am hacking together JSON parsing using osascript in that shell script. Let me know if you want me to switch to something like JQ or some other utility.
Jack Wellborn
Comment 2
2025-02-04 13:09:57 PST
Oh hey, it looks like Sequoia comes with JQ pre-installed so I have also included a a version of the shell script that simply tries to use JQ first.
Jack Wellborn
Comment 3
2025-02-04 13:10:57 PST
Created
attachment 474139
[details]
The same script that runs safaridriver, but tries using JQ to parse out the session ID
Radar WebKit Bug Importer
Comment 4
2025-02-11 12:03:18 PST
<
rdar://problem/144632782
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug