Commit e56c6eb
[feat]: add support for
# why
- adds support for a new function: `page.waitForSelector()`, which works
with cross-iframe selectors & cross-shadow root selectors
# what changed
- added `page.waitForSelector()` which returns `true` when the element
that the selector points to resolves, and times out with an error when
it does not resolve
# test plan
- added a bunch of e2e test cases, covering various CSS selector types,
& cross iframe/shadow root cases
<!-- This is an auto-generated description by cubic. -->
---
## Summary by cubic
Adds Page.waitForSelector() to wait for CSS or XPath targets to reach a
state, piercing shadow DOM and traversing iframes. This makes waits
reliable across complex trees and uses MutationObserver for efficiency.
- **New Features**
- Page.waitForSelector(selector, { state, timeout, pierceShadow }) with
states: attached, detached, visible, hidden (defaults: visible, 30s,
pierceShadow=true).
- Supports CSS and XPath (xpath= or /), including open and closed shadow
DOM via the V3 piercer.
- Works across iframes and with '>>' hop notation; resolves the correct
frame automatically.
- Clear timeout errors; no polling (MutationObserver-based).
- **Refactors**
- Added resolveLocatorTarget to unify hop/XPath frame resolution and
reuse in waitForSelector.
- Exported waitForSelector locator script under dom/locatorScripts.
<sup>Written for commit a238850.
Summary will update on new commits.</sup>
<!-- End of auto-generated description by cubic. -->
---------
Co-authored-by: tkattkat <tkat@tkat.net>page.waitForSelector() (#1509)1 parent 6fbf5fc commit e56c6eb
6 files changed
Lines changed: 1568 additions & 49 deletions
File tree
- .changeset
- packages/core/lib/v3
- dom/locatorScripts
- tests
- understudy
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
0 commit comments