You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# why
this PR addresses two issues, both related to scrolling inside iframes:
1. we are not calling `.evaluate` inside frames:
- currently, the scrolling functionality that exists inside
`performPlaywrightMethod` calls `page.evaluate`
- this means that scrolling can only ever happen at the page level, not
inside of iframes
- inside each of these scroll related helpers, we already have access to
a chained locator that optionally points to an element inside an iframe
- therefore, we should use this chained locator, and call
`locator.evaluate`
2. for SPIFs (same process iframes), we are not looking for scrollable
elements in the correct execution context:
- when we call `resolveObjectIdForXPath`, this executes in either the
page level execution context, or, for OOPIFs (out of process iframes),
the frame level execution context
- this is problematic because SPIFs share the the same CDP session as
the root document, which means that we are responsible for specifying
the execution context. since we aren't doing this,
`resolveObjectIdForXPath` only searches in the root document execution
context, and can't see anything inside of the SPIF
# what changed
- to address issue number 1, I updated `scrollToNextChunk`,
`scrollToPreviousChunk`, `scrollElementToPercentage` all use
`locator.evaluate` instead of `page.evaluate` which enables scrolling
inside (and outside) of iframes
- to address issue number 2, I added a function
`getFrameExecutionContextId` which creates an isolated world & returns a
SPIF scoped execution context
- we use this downstream in `resolveObjectIdForXPath` which guarantees
that we are searching for scrollable elements in the correct execution
context
# test plan
- added an eval for scrolling inside a same-process iframe
- `act` evals
- `targeted_extract` evals
- `observe` evals
- `extract` evals
0 commit comments