mirror of
https://github.com/microsoft/playwright.git
synced 2024-09-11 20:37:54 +03:00
docs: fix minor grammar and text issues (#24331)
This commit is contained in:
parent
2cb0622c39
commit
b93b2a7155
@ -2,7 +2,7 @@
|
|||||||
* since: v1.14
|
* since: v1.14
|
||||||
|
|
||||||
Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent
|
Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent
|
||||||
a way to find element(s) on the page at any moment. Locator can be created with the [`method: Page.locator`] method.
|
a way to find element(s) on the page at any moment. A locator can be created with the [`method: Page.locator`] method.
|
||||||
|
|
||||||
[Learn more about locators](../locators.md).
|
[Learn more about locators](../locators.md).
|
||||||
|
|
||||||
@ -10,8 +10,7 @@ a way to find element(s) on the page at any moment. Locator can be created with
|
|||||||
* since: v1.29
|
* since: v1.29
|
||||||
- returns: <[Array]<[Locator]>>
|
- returns: <[Array]<[Locator]>>
|
||||||
|
|
||||||
When locator points to a list of elements, returns array of locators, pointing
|
When the locator points to a list of elements, this returns an array of locators, pointing to their respective elements.
|
||||||
to respective elements.
|
|
||||||
|
|
||||||
:::note
|
:::note
|
||||||
[`method: Locator.all`] does not wait for elements to match the locator, and instead immediately returns whatever is present in the page.
|
[`method: Locator.all`] does not wait for elements to match the locator, and instead immediately returns whatever is present in the page.
|
||||||
|
@ -144,7 +144,7 @@ You can use the test generator to generate tests using emulation so as to genera
|
|||||||
|
|
||||||
### Emulate viewport size
|
### Emulate viewport size
|
||||||
|
|
||||||
Playwright opens a browser window with it's viewport set to a specific width and height and is not responsive as tests need to be run under the same conditions. Use the `--viewport` option to generate tests with a different viewport size.
|
Playwright opens a browser window with its viewport set to a specific width and height and is not responsive as tests need to be run under the same conditions. Use the `--viewport` option to generate tests with a different viewport size.
|
||||||
|
|
||||||
```bash js
|
```bash js
|
||||||
npx playwright codegen --viewport-size=800,600 playwright.dev
|
npx playwright codegen --viewport-size=800,600 playwright.dev
|
||||||
|
@ -200,7 +200,7 @@ For example, consider the following DOM structure.
|
|||||||
<button>Submit</button>
|
<button>Submit</button>
|
||||||
```
|
```
|
||||||
|
|
||||||
You can locate each element by it's implicit role:
|
You can locate each element by its implicit role:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
await expect(page.getByRole('heading', { name: 'Sign up' })).toBeVisible();
|
||||||
@ -519,7 +519,7 @@ For example, consider the following DOM structure.
|
|||||||
<button data-testid="directions">Itinéraire</button>
|
<button data-testid="directions">Itinéraire</button>
|
||||||
```
|
```
|
||||||
|
|
||||||
You can locate the element by it's test id:
|
You can locate the element by its test id:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
await page.getByTestId('directions').click();
|
await page.getByTestId('directions').click();
|
||||||
@ -1220,7 +1220,7 @@ await newEmail.ClickAsync();
|
|||||||
It's usually better to find a [more reliable way](./locators.md#quick-guide) to uniquely identify the element instead of checking the visibility.
|
It's usually better to find a [more reliable way](./locators.md#quick-guide) to uniquely identify the element instead of checking the visibility.
|
||||||
:::
|
:::
|
||||||
|
|
||||||
Consider a page with two buttons, first invisible and second [visible](./actionability.md#visible).
|
Consider a page with two buttons, the first invisible and the second [visible](./actionability.md#visible).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<button style='display: none'>Invisible</button>
|
<button style='display: none'>Invisible</button>
|
||||||
@ -1352,7 +1352,7 @@ await Expect(page
|
|||||||
There are many ways to get a specific item in a list.
|
There are many ways to get a specific item in a list.
|
||||||
#### Get by text
|
#### Get by text
|
||||||
|
|
||||||
Use the [`method: Page.getByText`] method to locate an element in a list by it's text content and then click on it.
|
Use the [`method: Page.getByText`] method to locate an element in a list by its text content and then click on it.
|
||||||
|
|
||||||
For example, consider the following DOM structure:
|
For example, consider the following DOM structure:
|
||||||
|
|
||||||
@ -1364,7 +1364,7 @@ For example, consider the following DOM structure:
|
|||||||
</ul>
|
</ul>
|
||||||
```
|
```
|
||||||
|
|
||||||
Locate an item by it's text content and click it.
|
Locate an item by its text content and click it.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
await page.getByText('orange').click();
|
await page.getByText('orange').click();
|
||||||
|
5
packages/playwright-core/types/types.d.ts
vendored
5
packages/playwright-core/types/types.d.ts
vendored
@ -10330,7 +10330,7 @@ export interface ElementHandle<T=Node> extends JSHandle<T> {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent a
|
* Locators are the central piece of Playwright's auto-waiting and retry-ability. In a nutshell, locators represent a
|
||||||
* way to find element(s) on the page at any moment. Locator can be created with the
|
* way to find element(s) on the page at any moment. A locator can be created with the
|
||||||
* [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator) method.
|
* [page.locator(selector[, options])](https://playwright.dev/docs/api/class-page#page-locator) method.
|
||||||
*
|
*
|
||||||
* [Learn more about locators](https://playwright.dev/docs/locators).
|
* [Learn more about locators](https://playwright.dev/docs/locators).
|
||||||
@ -10446,7 +10446,8 @@ export interface Locator {
|
|||||||
timeout?: number;
|
timeout?: number;
|
||||||
}): Promise<null|ElementHandle<SVGElement | HTMLElement>>;
|
}): Promise<null|ElementHandle<SVGElement | HTMLElement>>;
|
||||||
/**
|
/**
|
||||||
* When locator points to a list of elements, returns array of locators, pointing to respective elements.
|
* When the locator points to a list of elements, this returns an array of locators, pointing to their respective
|
||||||
|
* elements.
|
||||||
*
|
*
|
||||||
* **NOTE** [locator.all()](https://playwright.dev/docs/api/class-locator#locator-all) does not wait for elements to
|
* **NOTE** [locator.all()](https://playwright.dev/docs/api/class-locator#locator-all) does not wait for elements to
|
||||||
* match the locator, and instead immediately returns whatever is present in the page. When the list of elements
|
* match the locator, and instead immediately returns whatever is present in the page. When the list of elements
|
||||||
|
Loading…
Reference in New Issue
Block a user