Skip to content
Permalink
Browse files

docs(new): migrate ElementHandle to TSDoc (#6073)

* docs(new): migrate ElementHandle to TSDoc

Co-authored-by: Alex Rudenko <alexrudenko@chromium.org>
  • Loading branch information
OrKoN and Alex Rudenko committed Jun 22, 2020
1 parent 7025f1c commit 6657364364d65363c245d6463a25e896c6b237e1
Showing with 973 additions and 267 deletions.
  1. +13 −0 new-docs/puppeteer.boundingbox.height.md
  2. +22 −0 new-docs/puppeteer.boundingbox.md
  3. +13 −0 new-docs/puppeteer.boundingbox.width.md
  4. +13 −0 new-docs/puppeteer.boundingbox.x.md
  5. +13 −0 new-docs/puppeteer.boundingbox.y.md
  6. +14 −0 new-docs/puppeteer.boxmodel.border.md
  7. +14 −0 new-docs/puppeteer.boxmodel.content.md
  8. +11 −0 new-docs/puppeteer.boxmodel.height.md
  9. +14 −0 new-docs/puppeteer.boxmodel.margin.md
  10. +24 −0 new-docs/puppeteer.boxmodel.md
  11. +14 −0 new-docs/puppeteer.boxmodel.padding.md
  12. +11 −0 new-docs/puppeteer.boxmodel.width.md
  13. +11 −0 new-docs/puppeteer.clickoptions.button.md
  14. +11 −0 new-docs/puppeteer.clickoptions.clickcount.md
  15. +13 −0 new-docs/puppeteer.clickoptions.delay.md
  16. +21 −0 new-docs/puppeteer.clickoptions.md
  17. +0 −23 new-docs/puppeteer.createjshandle.md
  18. +2 −0 new-docs/puppeteer.elementhandle._.md
  19. +2 −0 new-docs/puppeteer.elementhandle.__.md
  20. +25 −0 new-docs/puppeteer.elementhandle.__eval.md
  21. +0 −18 new-docs/puppeteer.elementhandle._clickablepoint.md
  22. +0 −24 new-docs/puppeteer.elementhandle._constructor_.md
  23. +14 −0 new-docs/puppeteer.elementhandle._eval.md
  24. +0 −11 new-docs/puppeteer.elementhandle._framemanager.md
  25. +0 −25 new-docs/puppeteer.elementhandle._fromprotocolquad.md
  26. +0 −15 new-docs/puppeteer.elementhandle._getboxmodel.md
  27. +0 −30 new-docs/puppeteer.elementhandle._intersectquadwithviewport.md
  28. +0 −11 new-docs/puppeteer.elementhandle._page.md
  29. +0 −15 new-docs/puppeteer.elementhandle._scrollintoviewifneeded.md
  30. +3 −1 new-docs/puppeteer.elementhandle._x.md
  31. +4 −7 new-docs/puppeteer.elementhandle.boundingbox.md
  32. +6 −2 new-docs/puppeteer.elementhandle.boxmodel.md
  33. +4 −6 new-docs/puppeteer.elementhandle.click.md
  34. +2 −0 new-docs/puppeteer.elementhandle.contentframe.md
  35. +2 −0 new-docs/puppeteer.elementhandle.focus.md
  36. +2 −0 new-docs/puppeteer.elementhandle.hover.md
  37. +2 −0 new-docs/puppeteer.elementhandle.isintersectingviewport.md
  38. +39 −32 new-docs/puppeteer.elementhandle.md
  39. +11 −6 new-docs/puppeteer.elementhandle.press.md
  40. +2 −0 new-docs/puppeteer.elementhandle.screenshot.md
  41. +12 −1 new-docs/puppeteer.elementhandle.select.md
  42. +2 −0 new-docs/puppeteer.elementhandle.tap.md
  43. +24 −0 new-docs/puppeteer.elementhandle.type.md
  44. +3 −1 new-docs/puppeteer.elementhandle.uploadfile.md
  45. +2 −0 new-docs/puppeteer.jshandle.dispose.md
  46. +11 −0 new-docs/puppeteer.jshandle.evaluate.md
  47. +10 −0 new-docs/puppeteer.jshandle.evaluatehandle.md
  48. +18 −0 new-docs/puppeteer.jshandle.getproperties.md
  49. +6 −0 new-docs/puppeteer.jshandle.jsonvalue.md
  50. +6 −5 new-docs/puppeteer.jshandle.md
  51. +1 −1 new-docs/puppeteer.keyboard.down.md
  52. +1 −1 new-docs/puppeteer.keyboard.press.md
  53. +1 −1 new-docs/puppeteer.keyboard.up.md
  54. +11 −0 new-docs/puppeteer.keydefinition.code.md
  55. +11 −0 new-docs/puppeteer.keydefinition.key.md
  56. +11 −0 new-docs/puppeteer.keydefinition.keycode.md
  57. +11 −0 new-docs/puppeteer.keydefinition.location.md
  58. +33 −0 new-docs/puppeteer.keydefinition.md
  59. +11 −0 new-docs/puppeteer.keydefinition.shiftkey.md
  60. +11 −0 new-docs/puppeteer.keydefinition.shiftkeycode.md
  61. +11 −0 new-docs/puppeteer.keydefinition.shifttext.md
  62. +11 −0 new-docs/puppeteer.keydefinition.text.md
  63. +11 −0 new-docs/puppeteer.keydefinitions.md
  64. +11 −0 new-docs/puppeteer.keyinput.md
  65. +8 −7 new-docs/puppeteer.md
  66. +13 −0 new-docs/puppeteer.pressoptions.delay.md
  67. +20 −0 new-docs/puppeteer.pressoptions.md
  68. +13 −0 new-docs/puppeteer.pressoptions.text.md
  69. +1 −0 src/api-docs-entry.ts
  70. +312 −24 src/common/JSHandle.ts
  71. +14 −0 utils/doclint/check_public_api/index.js
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoundingBox](./puppeteer.boundingbox.md) &gt; [height](./puppeteer.boundingbox.height.md)

## BoundingBox.height property

the height of the element in pixels.

<b>Signature:</b>

```typescript
height: number;
```
@@ -0,0 +1,22 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoundingBox](./puppeteer.boundingbox.md)

## BoundingBox interface


<b>Signature:</b>

```typescript
export interface BoundingBox
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [height](./puppeteer.boundingbox.height.md) | number | the height of the element in pixels. |
| [width](./puppeteer.boundingbox.width.md) | number | the width of the element in pixels. |
| [x](./puppeteer.boundingbox.x.md) | number | the x coordinate of the element in pixels. |
| [y](./puppeteer.boundingbox.y.md) | number | the y coordinate of the element in pixels. |
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoundingBox](./puppeteer.boundingbox.md) &gt; [width](./puppeteer.boundingbox.width.md)

## BoundingBox.width property

the width of the element in pixels.

<b>Signature:</b>

```typescript
width: number;
```
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoundingBox](./puppeteer.boundingbox.md) &gt; [x](./puppeteer.boundingbox.x.md)

## BoundingBox.x property

the x coordinate of the element in pixels.

<b>Signature:</b>

```typescript
x: number;
```
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoundingBox](./puppeteer.boundingbox.md) &gt; [y](./puppeteer.boundingbox.y.md)

## BoundingBox.y property

the y coordinate of the element in pixels.

<b>Signature:</b>

```typescript
y: number;
```
@@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoxModel](./puppeteer.boxmodel.md) &gt; [border](./puppeteer.boxmodel.border.md)

## BoxModel.border property

<b>Signature:</b>

```typescript
border: Array<{
x: number;
y: number;
}>;
```
@@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoxModel](./puppeteer.boxmodel.md) &gt; [content](./puppeteer.boxmodel.content.md)

## BoxModel.content property

<b>Signature:</b>

```typescript
content: Array<{
x: number;
y: number;
}>;
```
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoxModel](./puppeteer.boxmodel.md) &gt; [height](./puppeteer.boxmodel.height.md)

## BoxModel.height property

<b>Signature:</b>

```typescript
height: number;
```
@@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoxModel](./puppeteer.boxmodel.md) &gt; [margin](./puppeteer.boxmodel.margin.md)

## BoxModel.margin property

<b>Signature:</b>

```typescript
margin: Array<{
x: number;
y: number;
}>;
```
@@ -0,0 +1,24 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoxModel](./puppeteer.boxmodel.md)

## BoxModel interface


<b>Signature:</b>

```typescript
export interface BoxModel
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [border](./puppeteer.boxmodel.border.md) | Array&lt;{ x: number; y: number; }&gt; | |
| [content](./puppeteer.boxmodel.content.md) | Array&lt;{ x: number; y: number; }&gt; | |
| [height](./puppeteer.boxmodel.height.md) | number | |
| [margin](./puppeteer.boxmodel.margin.md) | Array&lt;{ x: number; y: number; }&gt; | |
| [padding](./puppeteer.boxmodel.padding.md) | Array&lt;{ x: number; y: number; }&gt; | |
| [width](./puppeteer.boxmodel.width.md) | number | |
@@ -0,0 +1,14 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoxModel](./puppeteer.boxmodel.md) &gt; [padding](./puppeteer.boxmodel.padding.md)

## BoxModel.padding property

<b>Signature:</b>

```typescript
padding: Array<{
x: number;
y: number;
}>;
```
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [BoxModel](./puppeteer.boxmodel.md) &gt; [width](./puppeteer.boxmodel.width.md)

## BoxModel.width property

<b>Signature:</b>

```typescript
width: number;
```
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [ClickOptions](./puppeteer.clickoptions.md) &gt; [button](./puppeteer.clickoptions.button.md)

## ClickOptions.button property

<b>Signature:</b>

```typescript
button?: 'left' | 'right' | 'middle';
```
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [ClickOptions](./puppeteer.clickoptions.md) &gt; [clickCount](./puppeteer.clickoptions.clickcount.md)

## ClickOptions.clickCount property

<b>Signature:</b>

```typescript
clickCount?: number;
```
@@ -0,0 +1,13 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [ClickOptions](./puppeteer.clickoptions.md) &gt; [delay](./puppeteer.clickoptions.delay.md)

## ClickOptions.delay property

Time to wait between `mousedown` and `mouseup` in milliseconds.

<b>Signature:</b>

```typescript
delay?: number;
```
@@ -0,0 +1,21 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [puppeteer](./puppeteer.md) &gt; [ClickOptions](./puppeteer.clickoptions.md)

## ClickOptions interface


<b>Signature:</b>

```typescript
export interface ClickOptions
```
## Properties
| Property | Type | Description |
| --- | --- | --- |
| [button](./puppeteer.clickoptions.button.md) | 'left' \| 'right' \| 'middle' | |
| [clickCount](./puppeteer.clickoptions.clickcount.md) | number | |
| [delay](./puppeteer.clickoptions.delay.md) | number | Time to wait between <code>mousedown</code> and <code>mouseup</code> in milliseconds. |

This file was deleted.

@@ -4,6 +4,8 @@

## ElementHandle.$() method

The method runs `element.querySelector` within the page. If no element matches the selector, the return value resolves to `null`<!-- -->.

<b>Signature:</b>

```typescript
@@ -4,6 +4,8 @@

## ElementHandle.$$() method

The method runs `element.querySelectorAll` within the page. If no elements match the selector, the return value resolves to `[]`<!-- -->.

<b>Signature:</b>

```typescript
@@ -4,6 +4,10 @@

## ElementHandle.$$eval() method

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.

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

<b>Signature:</b>

```typescript
@@ -22,3 +26,24 @@ $$eval<ReturnType extends any>(selector: string, pageFunction: Function | string
Promise&lt;ReturnType&gt;
## Example 1
```html
<div class="feed">
<div class="tweet">Hello!</div>
<div class="tweet">Hi!</div>
</div>
```
## Example 2
```js
const feedHandle = await page.$('.feed');
expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText)))
.toEqual(['Hello!', 'Hi!']);
```

This file was deleted.

This file was deleted.

@@ -4,6 +4,10 @@

## ElementHandle.$eval() method

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.

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

<b>Signature:</b>

```typescript
@@ -22,3 +26,13 @@ $eval<ReturnType extends any>(selector: string, pageFunction: Function | string,
Promise&lt;ReturnType&gt;
## Example
```js
const tweetHandle = await page.$('.tweet');
expect(await tweetHandle.$eval('.like', node => node.innerText)).toBe('100');
expect(await tweetHandle.$eval('.retweets', node => node.innerText)).toBe('10');
```

0 comments on commit 6657364

Please sign in to comment.
You can’t perform that action at this time.