Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(new): migrate ElementHandle to TSDoc #6073

Merged
merged 4 commits into from Jun 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions new-docs/puppeteer.boundingbox.height.md
@@ -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;
```
22 changes: 22 additions & 0 deletions new-docs/puppeteer.boundingbox.md
@@ -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. |

13 changes: 13 additions & 0 deletions new-docs/puppeteer.boundingbox.width.md
@@ -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;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.boundingbox.x.md
@@ -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;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.boundingbox.y.md
@@ -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;
```
14 changes: 14 additions & 0 deletions new-docs/puppeteer.boxmodel.border.md
@@ -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;
}>;
```
14 changes: 14 additions & 0 deletions new-docs/puppeteer.boxmodel.content.md
@@ -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;
}>;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.boxmodel.height.md
@@ -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;
```
14 changes: 14 additions & 0 deletions new-docs/puppeteer.boxmodel.margin.md
@@ -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;
}>;
```
24 changes: 24 additions & 0 deletions new-docs/puppeteer.boxmodel.md
@@ -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 | |

14 changes: 14 additions & 0 deletions new-docs/puppeteer.boxmodel.padding.md
@@ -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;
}>;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.boxmodel.width.md
@@ -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;
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.clickoptions.button.md
@@ -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';
```
11 changes: 11 additions & 0 deletions new-docs/puppeteer.clickoptions.clickcount.md
@@ -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;
```
13 changes: 13 additions & 0 deletions new-docs/puppeteer.clickoptions.delay.md
@@ -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;
```
21 changes: 21 additions & 0 deletions new-docs/puppeteer.clickoptions.md
@@ -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. |

23 changes: 0 additions & 23 deletions new-docs/puppeteer.createjshandle.md

This file was deleted.

2 changes: 2 additions & 0 deletions new-docs/puppeteer.elementhandle._.md
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions new-docs/puppeteer.elementhandle.__.md
Expand Up @@ -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
Expand Down
25 changes: 25 additions & 0 deletions new-docs/puppeteer.elementhandle.__eval.md
Expand Up @@ -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
Expand All @@ -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!']);

```

18 changes: 0 additions & 18 deletions new-docs/puppeteer.elementhandle._clickablepoint.md

This file was deleted.

24 changes: 0 additions & 24 deletions new-docs/puppeteer.elementhandle._constructor_.md

This file was deleted.

14 changes: 14 additions & 0 deletions new-docs/puppeteer.elementhandle._eval.md
Expand Up @@ -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
Expand All @@ -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');

```