Skip to content

Commit 3fefa7b

Browse files
authored
docs: fix docs for $foo methods that assumed css selectors (#2039)
1 parent b94f910 commit 3fefa7b

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

docs/api.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -845,15 +845,15 @@ Emitted when a dedicated [WebWorker](https://developer.mozilla.org/en-US/docs/We
845845
- `selector` <[string]> A selector to query page for
846846
- returns: <[Promise]<?[ElementHandle]>>
847847

848-
The method runs `document.querySelector` within the page. If no element matches the selector, the return value resolves to `null`.
848+
The method finds an element matching the specified selector within the page. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to `null`.
849849

850850
Shortcut for [page.mainFrame().$(selector)](#frameselector).
851851

852852
#### page.$$(selector)
853853
- `selector` <[string]> A selector to query page for
854854
- returns: <[Promise]<[Array]<[ElementHandle]>>>
855855

856-
The method runs `document.querySelectorAll` within the page. If no elements match the selector, the return value resolves to `[]`.
856+
The method finds all elements matching the specified selector within the page. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to `[]`.
857857

858858
Shortcut for [page.mainFrame().$$(selector)](#frameselector-1).
859859

@@ -863,7 +863,7 @@ Shortcut for [page.mainFrame().$$(selector)](#frameselector-1).
863863
- `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction`
864864
- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`
865865

866-
This method runs `document.querySelector` within the page and passes it as the first argument to `pageFunction`. If there's no element matching `selector`, the method throws an error.
866+
The method finds an element matching the specified selector within the page and passes it as a first argument to `pageFunction`. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the method throws an error.
867867

868868
If `pageFunction` returns a [Promise], then `page.$eval` would wait for the promise to resolve and return its value.
869869

@@ -882,7 +882,7 @@ Shortcut for [page.mainFrame().$eval(selector, pageFunction)](#frameevalselector
882882
- `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction`
883883
- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`
884884

885-
This method runs `Array.from(document.querySelectorAll(selector))` within the page and passes it as the first argument to `pageFunction`.
885+
The method finds all elements matching the specified selector within the page and passes an array of matched elements as a first argument to `pageFunction`. See [Working with selectors](#working-with-selectors) for more details.
886886

887887
If `pageFunction` returns a [Promise], then `page.$$eval` would wait for the promise to resolve and return its value.
888888

@@ -1941,21 +1941,21 @@ An example of getting text from an iframe element:
19411941
- `selector` <[string]> A selector to query frame for
19421942
- returns: <[Promise]<?[ElementHandle]>> Promise which resolves to ElementHandle pointing to the frame element.
19431943

1944-
The method queries frame for the selector. If there's no such element within the frame, the method will resolve to `null`.
1944+
The method finds an element matching the specified selector within the frame. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to `null`.
19451945

19461946
#### frame.$$(selector)
19471947
- `selector` <[string]> A selector to query frame for
19481948
- returns: <[Promise]<[Array]<[ElementHandle]>>> Promise which resolves to ElementHandles pointing to the frame elements.
19491949

1950-
The method runs `document.querySelectorAll` within the frame. If no elements match the selector, the return value resolves to `[]`.
1950+
The method finds all elements matching the specified selector within the frame. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to `[]`.
19511951

19521952
#### frame.$eval(selector, pageFunction[, arg])
19531953
- `selector` <[string]> A selector to query frame for
19541954
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
19551955
- `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction`
19561956
- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`
19571957

1958-
This method runs `document.querySelector` within the frame and passes it as the first argument to `pageFunction`. If there's no element matching `selector`, the method throws an error.
1958+
The method finds an element matching the specified selector within the frame and passes it as a first argument to `pageFunction`. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the method throws an error.
19591959

19601960
If `pageFunction` returns a [Promise], then `frame.$eval` would wait for the promise to resolve and return its value.
19611961

@@ -1972,7 +1972,7 @@ const html = await frame.$eval('.main-container', (e, suffix) => e.outerHTML + s
19721972
- `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction`
19731973
- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`
19741974

1975-
This method runs `Array.from(document.querySelectorAll(selector))` within the frame and passes it as the first argument to `pageFunction`.
1975+
The method finds all elements matching the specified selector within the frame and passes an array of matched elements as a first argument to `pageFunction`. See [Working with selectors](#working-with-selectors) for more details.
19761976

19771977
If `pageFunction` returns a [Promise], then `frame.$$eval` would wait for the promise to resolve and return its value.
19781978

@@ -2538,21 +2538,21 @@ ElementHandle instances can be used as an argument in [`page.$eval()`](#pageeval
25382538
- `selector` <[string]> A selector to query element for
25392539
- returns: <[Promise]<?[ElementHandle]>>
25402540

2541-
The method runs `element.querySelector` within the page. If no element matches the selector, the return value resolves to `null`.
2541+
The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to `null`.
25422542

25432543
#### elementHandle.$$(selector)
25442544
- `selector` <[string]> A selector to query element for
25452545
- returns: <[Promise]<[Array]<[ElementHandle]>>>
25462546

2547-
The method runs `element.querySelectorAll` within the page. If no elements match the selector, the return value resolves to `[]`.
2547+
The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the return value resolves to `[]`.
25482548

25492549
#### elementHandle.$eval(selector, pageFunction[, arg])
25502550
- `selector` <[string]> A selector to query page for
25512551
- `pageFunction` <[function]\([Element]\)> Function to be evaluated in browser context
25522552
- `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction`
25532553
- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`
25542554

2555-
This method runs `document.querySelector` within the element and passes it as the first argument to `pageFunction`. If there's no element matching `selector`, the method throws an error.
2555+
The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first argument to `pageFunction`. See [Working with selectors](#working-with-selectors) for more details. If no elements match the selector, the method throws an error.
25562556

25572557
If `pageFunction` returns a [Promise], then `frame.$eval` would wait for the promise to resolve and return its value.
25582558

@@ -2569,7 +2569,7 @@ expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
25692569
- `arg` <[Serializable]|[JSHandle]> Optional argument to pass to `pageFunction`
25702570
- returns: <[Promise]<[Serializable]>> Promise which resolves to the return value of `pageFunction`
25712571

2572-
This method runs `document.querySelectorAll` within the element and passes it as the first argument to `pageFunction`. If there's no element matching `selector`, the method throws an error.
2572+
The method finds all elements matching the specified selector in the `ElementHandle`'s subtree and passes an array of matched elements as a first argument to `pageFunction`. See [Working with selectors](#working-with-selectors) for more details.
25732573

25742574
If `pageFunction` returns a [Promise], then `frame.$$eval` would wait for the promise to resolve and return its value.
25752575

0 commit comments

Comments
 (0)