Fix select_all(include_frames=True) not searching nested iframes#246
Fix select_all(include_frames=True) not searching nested iframes#246chronoAP wants to merge 4 commits into
Conversation
CDP's querySelectorAll only queries within a single document boundary and does not cross into iframe content_document subtrees. This meant elements inside nested iframes were never found. Walk the full DOM tree to collect each iframe's content_document and query them individually. Also adds a guard for cross-origin iframes where content_document is None, and fixes the fullscreen() docstring.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
stephanlensky
left a comment
There was a problem hiding this comment.
Thanks @chronoAP, this change looks great to me. Sorry for the delayed response, I've been pretty busy at work and haven't had as much time to spend on this project.
Would you be open to adding a unit test to verify the fix works?
No worries at all. Sure, I could give it a shot. |
|
This pull request has been marked stale because it has been open for 30 days with no activity. If there is no activity within 7 days, it will be automatically closed. |
|
Sorry for the delay, been super busy. I added the unit test. I had codex write it FYI, but the original fix above I wrote myself. |
Description
Originally submitted by: nzxcvz
fqx Verified that it does not find child nodes with find(), and I verified using their test that select_all() has the same behaviour.
Fixes #239
CDP's querySelectorAll only queries within a single document boundary and does not cross into iframe content_document subtrees. This meant elements inside nested iframes were never found.
Walk the full DOM tree to collect each iframe's content_document and query them individually.
Also fixed an issue I had related to this function during use, and something I noticed while snooping the code base: add a guard for cross-origin iframes where content_document is None, and fixes the fullscreen() docstring.
Pre-merge Checklist
./scripts/format.shand./scripts/lint.shscripts. My code is properly formatted and has no linting errors.uv run pytestand ensured all tests pass.[Unreleased]section.