docs: remove selectors from getting started (#18403)
This commit is contained in:
parent
c07f06aa3f
commit
8e9540b7c1
|
|
@ -5,7 +5,7 @@ title: "Writing Tests"
|
|||
|
||||
Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met. Playwright comes with [auto-wait](./actionability.md) built in meaning it waits for elements to be actionable prior to performing actions. Playwright provides the [Expect](./test-assertions) function to write assertions.
|
||||
|
||||
Take a look at the example test below to see how to write a test using web first assertions, locators and selectors.
|
||||
Take a look at the example test below to see how to write a test using using [locators](/locators.md) and web first assertions.
|
||||
|
||||
<Tabs
|
||||
groupId="test-runners"
|
||||
|
|
@ -99,7 +99,7 @@ await Expect(Page).ToHaveTitleAsync(new Regex("Playwright"));
|
|||
|
||||
### Locators
|
||||
|
||||
[Locators](./locators.md) are the central piece of Playwright's auto-waiting and retry-ability. Locators represent a way to find element(s) on the page at any moment and are used to perform actions on elements such as `.ClickAsync` `.FillAsync` etc. Custom locators can be created with the [`method: Page.locator`] method.
|
||||
[Locators](./locators.md) are the central piece of Playwright's auto-waiting and retry-ability. Locators represent a way to find element(s) on the page at any moment and are used to perform actions on elements such as `.ClickAsync` `.FillAsync` etc.
|
||||
|
||||
```csharp
|
||||
var getStarted = Page.GetByRole(AriaRole.Link, new() { NameString = "Get started" });
|
||||
|
|
@ -108,13 +108,6 @@ await Expect(getStarted).ToHaveAttributeAsync("href", "/docs/installation");
|
|||
await getStarted.ClickAsync();
|
||||
```
|
||||
|
||||
[Selectors](./selectors.md) are strings that are used to create Locators. Playwright supports many different selectors like [Text](./selectors.md#text-selector), [CSS](./selectors.md#css-selector), [XPath](./selectors.md#xpath-selectors) and many more. Learn more about available selectors and how to pick one in this [in-depth guide](./selectors.md).
|
||||
|
||||
```csharp
|
||||
await Expect(Page.GetByRole(AriaRole.Heading, new() { NameString = "Installation" })).ToBeVisibleAsync();
|
||||
```
|
||||
|
||||
|
||||
### Test Isolation
|
||||
|
||||
The Playwright NUnit and MSTest test framework base classes will isolate each test from each other by providing a separate `Page` instance. Pages are isolated between tests due to the Browser Context, which is equivalent to a brand new browser profile, where every test gets a fresh environment, even when multiple tests run in a single Browser.
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ Playwright assertions are created specifically for the dynamic web. Checks are a
|
|||
|
||||
## The Example Test
|
||||
|
||||
Take a look at the example test included when installing Playwright to see how to write a test using [web first assertions](/test-assertions.md), [locators](/locators.md) and [selectors](/selectors.md).
|
||||
Take a look at the example test included when installing Playwright to see how to write a test using [locators](/locators.md) and [web first assertions](/test-assertions.md).
|
||||
|
||||
```js tab=js-js
|
||||
// @ts-check
|
||||
|
|
@ -79,7 +79,7 @@ await expect(page).toHaveTitle(/Playwright/);
|
|||
|
||||
### Locators
|
||||
|
||||
[Locators](./locators.md) are the central piece of Playwright's auto-waiting and retry-ability. Locators represent a way to find element(s) on the page at any moment and are used to perform actions on elements such as `.click` `.fill` etc. Custom locators can be created with the [`method: Page.locator`] method.
|
||||
[Locators](./locators.md) are the central piece of Playwright's auto-waiting and retry-ability. Locators represent a way to find element(s) on the page at any moment and are used to perform actions on elements such as `.click` `.fill` etc.
|
||||
|
||||
```js
|
||||
const getStarted = page.getByRole('link', { name: 'Get started' });
|
||||
|
|
@ -88,14 +88,6 @@ await expect(getStarted).toHaveAttribute('href', '/docs/installation');
|
|||
await getStarted.click();
|
||||
```
|
||||
|
||||
[Selectors](./selectors.md) are strings that are used to create Locators. Playwright supports many different selectors like [Text](./selectors.md#text-selector), [CSS](./selectors.md#css-selector), [XPath](./selectors.md#xpath-selectors) and many more. Learn more about available selectors and how to pick one in this [in-depth guide](./selectors.md).
|
||||
|
||||
|
||||
```js
|
||||
await expect(page.getByRole('heading', { name: 'Installation' })).toBeVisible();
|
||||
```
|
||||
|
||||
|
||||
### Test Isolation
|
||||
|
||||
Playwright Test is based on the concept of [test fixtures](./test-fixtures.md) such as the [built in page fixture](./test-fixtures#built-in-fixtures), which is passed into your test. Pages are isolated between tests due to the Browser Context, which is equivalent to a brand new browser profile, where every test gets a fresh environment, even when multiple tests run in a single Browser.
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ title: "Writing Tests"
|
|||
|
||||
Playwright assertions are created specifically for the dynamic web. Checks are automatically retried until the necessary conditions are met. Playwright comes with [auto-wait](./actionability.md) built in meaning it waits for elements to be actionable prior to performing actions. Playwright provides an [expect](./test-assertions.md) function to write assertions.
|
||||
|
||||
Take a look at the example test below to see how to write a test using web first assertions, locators and selectors.
|
||||
Take a look at the example test below to see how to write a test using [locators](/locators.md) and web first assertions.
|
||||
|
||||
```python
|
||||
import re
|
||||
|
|
@ -46,7 +46,7 @@ expect(page).to_have_title(re.compile("Playwright"))
|
|||
|
||||
### Locators
|
||||
|
||||
[Locators](./locators.md) are the central piece of Playwright's auto-waiting and retry-ability. Locators represent a way to find element(s) on the page at any moment and are used to perform actions on elements such as `.click` `.fill` etc. Custom locators can be created with the [`method: Page.locator`] method.
|
||||
[Locators](./locators.md) are the central piece of Playwright's auto-waiting and retry-ability. Locators represent a way to find element(s) on the page at any moment and are used to perform actions on elements such as `.click` `.fill` etc.
|
||||
|
||||
```python
|
||||
from playwright.sync_api import expect
|
||||
|
|
@ -57,16 +57,6 @@ expect(get_started).to_have_attribute("href", "/docs/installation")
|
|||
get_started.click()
|
||||
```
|
||||
|
||||
[Selectors](./selectors.md) are strings that are used to create Locators. Playwright supports many different selectors like [Text](./selectors.md#text-selector), [CSS](./selectors.md#css-selector), [XPath](./selectors.md#xpath-selectors) and many more. Learn more about available selectors and how to pick one in this [in-depth guide](./selectors.md).
|
||||
|
||||
|
||||
```python
|
||||
from playwright.sync_api import expect
|
||||
|
||||
expect(page.get_by_role("heading", name="Installation")).to_be_visible()
|
||||
```
|
||||
|
||||
|
||||
### Test Isolation
|
||||
|
||||
The Playwright Pytest plugin is based on the concept of test fixtures such as the [built in page fixture](./test-runners.md), which is passed into your test. Pages are isolated between tests due to the Browser Context, which is equivalent to a brand new browser profile, where every test gets a fresh environment, even when multiple tests run in a single Browser.
|
||||
|
|
|
|||
Loading…
Reference in a new issue