Skip to content

fix(web): handle stale iframe in fetchCrossOriginIframeContent#3314

Merged
proksh merged 2 commits into
mainfrom
fix/cross-origin-iframe-stale-element
May 27, 2026
Merged

fix(web): handle stale iframe in fetchCrossOriginIframeContent#3314
proksh merged 2 commits into
mainfrom
fix/cross-origin-iframe-stale-element

Conversation

@proksh
Copy link
Copy Markdown
Contributor

@proksh proksh commented May 22, 2026

switchTo().frame() sat outside the try/catch in fetchCrossOriginIframeContent, so a StaleElementReferenceException (iframe removed/replaced between findElement and switchTo on dynamic pages) escaped the method instead of degrading to the same null return every other failure already produces. Caller already handles null by emitting an empty-children placeholder, so the hierarchy renders without the cross-origin iframe and the test continues.

Mirrors the same fix into CdpWebDriver.

proksh added 2 commits May 22, 2026 11:58
Move switchTo().frame() inside the existing try/catch so a
StaleElementReferenceException (iframe removed between findElement and
switchTo on dynamic pages) degrades to a null return instead of escaping
the method. Mirrors the same fix in CdpWebDriver.
Mock switchTo().frame() to throw StaleElementReferenceException and
assert the method returns null (graceful skip) instead of propagating.
@Fishbowler
Copy link
Copy Markdown
Contributor

Related to #3289 ?

@proksh
Copy link
Copy Markdown
Contributor Author

proksh commented May 22, 2026

Related to #3289 ?

Yes somewhat.

#3314 - Handles StaleElementReferenceException in a simpler way
#3315 - Covers Selenium exceptions handling in a simpler way

But there are more changes in #3289, that are worth reviewing, but the PR would need to revert the above changes it has.

Copy link
Copy Markdown
Contributor

@pedro18x pedro18x left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@schmayterling
Copy link
Copy Markdown

Hey @proksh, can i get insight if you'd want me to revert changes in 3289 and make it more targeted?

@proksh
Copy link
Copy Markdown
Contributor Author

proksh commented May 27, 2026

Hey @proksh, can i get insight if you'd want me to revert changes in 3289 and make it more targeted?

Reviewed and left comments on your PR.

@proksh proksh merged commit 2cd048e into main May 27, 2026
14 of 15 checks passed
@proksh proksh deleted the fix/cross-origin-iframe-stale-element branch May 27, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants