Skip to content

Commit

Permalink
chore(docs): aliases for dotnet/chsarp docs. (#5162)
Browse files Browse the repository at this point in the history
Co-authored-by: Yury Semikhatsky <yurys@chromium.org>
  • Loading branch information
avodovnik and yury-s committed Jan 29, 2021
1 parent 69ca308 commit dbcdf9d
Show file tree
Hide file tree
Showing 12 changed files with 380 additions and 351 deletions.
7 changes: 7 additions & 0 deletions docs/src/api/class-browsertype.md
Expand Up @@ -182,6 +182,13 @@ Maximum time in milliseconds to wait for the browser instance to start. Defaults
disable timeout.

### option: BrowserType.launch.env
* langs: csharp,java
- `env` <[Object]<[string], [string]>>

Specify environment variables that will be visible to the browser. Defaults to `process.env`.

### option: BrowserType.launch.env
* langs: js,python
- `env` <[Object]<[string], [string]|[float]|[boolean]>>

Specify environment variables that will be visible to the browser. Defaults to `process.env`.
Expand Down
232 changes: 118 additions & 114 deletions docs/src/api/class-elementhandle.md
@@ -1,7 +1,7 @@
# class: ElementHandle
* extends: [JSHandle]

ElementHandle represents an in-page DOM element. ElementHandles can be created with the [`method: Page.$`] method.
ElementHandle represents an in-page DOM element. ElementHandles can be created with the [`method: Page.querySelector`] method.

```js
const { chromium } = require('playwright'); // Or 'firefox' or 'webkit'.
Expand Down Expand Up @@ -54,119 +54,7 @@ with sync_playwright() as playwright:
ElementHandle prevents DOM element from garbage collection unless the handle is disposed with
[`method: JSHandle.dispose`]. ElementHandles are auto-disposed when their origin frame gets navigated.

ElementHandle instances can be used as an argument in [`method: Page.$eval`] and [`method: Page.evaluate`] methods.

## async method: ElementHandle.$
* langs:
- alias-python: query_selector
- returns: <[null]|[ElementHandle]>

The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
returns `null`.

### param: ElementHandle.$.selector = %%-query-selector-%%

## async method: ElementHandle.$$
* langs:
- alias-python: query_selector_all
- returns: <[Array]<[ElementHandle]>>

The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
returns empty array.

### param: ElementHandle.$$.selector = %%-query-selector-%%

## async method: ElementHandle.$eval
* langs:
- alias-python: eval_on_selector
- returns: <[Serializable]>

Returns the return value of [`param: pageFunction`]

The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first
argument to [`param: pageFunction`]. See [Working with selectors](./selectors.md) for more
details. If no elements match the selector, the method throws an error.

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

Examples:

```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');
```

```python async
tweet_handle = await page.query_selector(".tweet")
assert await tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
assert await tweet_handle.eval_on_selector(".retweets", "node => node.innerText") = "10"
```

```python sync
tweet_handle = page.query_selector(".tweet")
assert tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
assert tweet_handle.eval_on_selector(".retweets", "node => node.innerText") = "10"
```

### param: ElementHandle.$eval.selector = %%-query-selector-%%

### param: ElementHandle.$eval.expression = %%-evaluate-expression-%%

### param: ElementHandle.$eval.arg
- `arg` <[EvaluationArgument]>

Optional argument to pass to [`param: pageFunction`]

## async method: ElementHandle.$$eval
* langs:
- alias-python: eval_on_selector_all
- returns: <[Serializable]>

Returns the return value of [`param: pageFunction`]

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 [`param: pageFunction`]. See
[Working with selectors](./selectors.md) for more details.

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

Examples:

```html
<div class="feed">
<div class="tweet">Hello!</div>
<div class="tweet">Hi!</div>
</div>
```

```js
const feedHandle = await page.$('.feed');
expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);
```

```python async
feed_handle = await page.query_selector(".feed")
assert await feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
```

```python sync
feed_handle = page.query_selector(".feed")
assert feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
```

### param: ElementHandle.$$eval.selector = %%-query-selector-%%

### param: ElementHandle.$$eval.expression = %%-evaluate-expression-%%

### param: ElementHandle.$$eval.arg
- `arg` <[EvaluationArgument]>

Optional argument to pass to [`param: pageFunction`]
ElementHandle instances can be used as an argument in [`method: Page.evalOnSelector`] and [`method: Page.evaluate`] methods.

## async method: ElementHandle.boundingBox
- returns: <[null]|[Object]>
Expand Down Expand Up @@ -353,6 +241,98 @@ DOM event type: `"click"`, `"dragstart"`, etc.

Optional event-specific initialization properties.

## async method: ElementHandle.evalOnSelector
* langs:
- alias-python: eval_on_selector
- alias-js: $eval
- returns: <[Serializable]>

Returns the return value of [`param: pageFunction`]

The method finds an element matching the specified selector in the `ElementHandle`s subtree and passes it as a first
argument to [`param: pageFunction`]. See [Working with selectors](./selectors.md) for more
details. If no elements match the selector, the method throws an error.

If [`param: pageFunction`] returns a [Promise], then [`method: ElementHandle.evalOnSelector`] would wait for the promise to resolve and return its
value.

Examples:

```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');
```

```python async
tweet_handle = await page.query_selector(".tweet")
assert await tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
assert await tweet_handle.eval_on_selector(".retweets", "node => node.innerText") = "10"
```

```python sync
tweet_handle = page.query_selector(".tweet")
assert tweet_handle.eval_on_selector(".like", "node => node.innerText") == "100"
assert tweet_handle.eval_on_selector(".retweets", "node => node.innerText") = "10"
```

### param: ElementHandle.evalOnSelector.selector = %%-query-selector-%%

### param: ElementHandle.evalOnSelector.expression = %%-evaluate-expression-%%

### param: ElementHandle.evalOnSelector.arg
- `arg` <[EvaluationArgument]>

Optional argument to pass to [`param: pageFunction`]

## async method: ElementHandle.evalOnSelectorAll
* langs:
- alias-python: eval_on_selector_all
- alias-js: $$eval
- returns: <[Serializable]>

Returns the return value of [`param: pageFunction`]

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 [`param: pageFunction`]. See
[Working with selectors](./selectors.md) for more details.

If [`param: pageFunction`] returns a [Promise], then [`method: ElementHandle.evalOnSelectorAll`] would wait for the promise to resolve and return its
value.

Examples:

```html
<div class="feed">
<div class="tweet">Hello!</div>
<div class="tweet">Hi!</div>
</div>
```

```js
const feedHandle = await page.$('.feed');
expect(await feedHandle.$$eval('.tweet', nodes => nodes.map(n => n.innerText))).toEqual(['Hello!', 'Hi!']);
```

```python async
feed_handle = await page.query_selector(".feed")
assert await feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
```

```python sync
feed_handle = page.query_selector(".feed")
assert feed_handle.eval_on_selector_all(".tweet", "nodes => nodes.map(n => n.innerText)") == ["hello!", "hi!"]
```

### param: ElementHandle.evalOnSelectorAll.selector = %%-query-selector-%%

### param: ElementHandle.evalOnSelectorAll.expression = %%-evaluate-expression-%%

### param: ElementHandle.evalOnSelectorAll.arg
- `arg` <[EvaluationArgument]>

Optional argument to pass to [`param: pageFunction`]

## async method: ElementHandle.fill

This method waits for [actionability](./actionability.md) checks, focuses the element, fills it and triggers an `input` event after filling.
Expand Down Expand Up @@ -485,6 +465,30 @@ Time to wait between `keydown` and `keyup` in milliseconds. Defaults to 0.

### option: ElementHandle.press.timeout = %%-input-timeout-%%

## async method: ElementHandle.querySelector
* langs:
- alias-python: query_selector
- alias-js: $
- returns: <[null]|[ElementHandle]>

The method finds an element matching the specified selector in the `ElementHandle`'s subtree. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
returns `null`.

### param: ElementHandle.querySelector.selector = %%-query-selector-%%

## async method: ElementHandle.querySelectorAll
* langs:
- alias-python: query_selector_all
- alias-js: $$
- returns: <[Array]<[ElementHandle]>>

The method finds all elements matching the specified selector in the `ElementHandle`s subtree. See
[Working with selectors](./selectors.md) for more details. If no elements match the selector,
returns empty array.

### param: ElementHandle.querySelectorAll.selector = %%-query-selector-%%

## async method: ElementHandle.screenshot
- returns: <[Buffer]>

Expand Down

0 comments on commit dbcdf9d

Please sign in to comment.