Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions dotnet/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2313,6 +2313,29 @@ When all steps combined have not finished during the specified [Timeout](/api/cl

---

### Visible {#locator-visible}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.51</font><x-search>locator.Visible</x-search>

Returns a locator that only matches [visible](../actionability.mdx#visible) elements.

**Usage**

```csharp
Locator.Visible(options);
```

**Arguments**
- `options` `LocatorVisibleOptions?` *(optional)*
- `Visible` [bool]? *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-option-visible"/><a href="#locator-visible-option-visible" class="list-anchor">#</a>

Whether to match visible or invisible elements.

**Returns**
- [Locator]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-return"/><a href="#locator-visible-return" class="list-anchor">#</a>

---

### WaitForAsync {#locator-wait-for}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>locator.WaitForAsync</x-search>
Expand Down
2 changes: 1 addition & 1 deletion dotnet/docs/locators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ Consider a page with two buttons, the first invisible and the second [visible](.
* This will only find a second button, because it is visible, and then click it.

```csharp
await page.Locator("button").Locator("visible=true").ClickAsync();
await page.Locator("button").Visible().ClickAsync();
```

## Lists
Expand Down
24 changes: 24 additions & 0 deletions java/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2313,6 +2313,30 @@ When all steps combined have not finished during the specified [setTimeout](/api

---

### visible {#locator-visible}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.51</font><x-search>locator.visible</x-search>

Returns a locator that only matches [visible](../actionability.mdx#visible) elements.

**Usage**

```java
Locator.visible();
Locator.visible(options);
```

**Arguments**
- `options` `Locator.VisibleOptions` *(optional)*
- `setVisible` [boolean] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-option-visible"/><a href="#locator-visible-option-visible" class="list-anchor">#</a>

Whether to match visible or invisible elements.

**Returns**
- [Locator]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-return"/><a href="#locator-visible-return" class="list-anchor">#</a>

---

### waitFor {#locator-wait-for}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>locator.waitFor</x-search>
Expand Down
2 changes: 1 addition & 1 deletion java/docs/locators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ Consider a page with two buttons, the first invisible and the second [visible](.
* This will only find a second button, because it is visible, and then click it.

```java
page.locator("button").locator("visible=true").click();
page.locator("button").visible().click();
```

## Lists
Expand Down
24 changes: 24 additions & 0 deletions nodejs/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2323,6 +2323,30 @@ When all steps combined have not finished during the specified [timeout](/api/cl

---

### visible {#locator-visible}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.51</font><x-search>locator.visible</x-search>

Returns a locator that only matches [visible](../actionability.mdx#visible) elements.

**Usage**

```js
locator.visible();
locator.visible(options);
```

**Arguments**
- `options` [Object] *(optional)*
- `visible` [boolean] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-option-visible"/><a href="#locator-visible-option-visible" class="list-anchor">#</a>

Whether to match visible or invisible elements.

**Returns**
- [Locator]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-return"/><a href="#locator-visible-return" class="list-anchor">#</a>

---

### waitFor {#locator-wait-for}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>locator.waitFor</x-search>
Expand Down
35 changes: 5 additions & 30 deletions nodejs/docs/api/class-testconfig.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export default defineConfig({

Metadata contains key-value pairs to be included in the report. For example, HTML report will display it as key-value pairs, and JSON report will include metadata serialized as json.

See also [testConfig.populateGitInfo](/api/class-testconfig.mdx#test-config-populate-git-info) that populates metadata.
Providing `'git.commit.info': {}` property will populate it with the git commit details. This is useful for CI/CD environments.

**Usage**

Expand Down Expand Up @@ -418,31 +418,6 @@ test('example test', async ({}, testInfo) => {

---

### populateGitInfo {#test-config-populate-git-info}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.51</font><x-search>testConfig.populateGitInfo</x-search>

Whether to populate `'git.commit.info'` field of the [testConfig.metadata](/api/class-testconfig.mdx#test-config-metadata) with Git commit info and CI/CD information.

This information will appear in the HTML and JSON reports and is available in the Reporter API.

On Github Actions, this feature is enabled by default.

**Usage**

```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';

export default defineConfig({
populateGitInfo: !!process.env.CI,
});
```

**Type**
- [boolean]

---

### preserveOutput {#test-config-preserve-output}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.10</font><x-search>testConfig.preserveOutput</x-search>
Expand Down Expand Up @@ -963,7 +938,7 @@ import { defineConfig } from '@playwright/test';
export default defineConfig({
webServer: {
command: 'npm run start',
url: 'http://127.0.0.1:3000',
url: 'http://localhost:3000',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
Expand Down Expand Up @@ -992,19 +967,19 @@ export default defineConfig({
webServer: [
{
command: 'npm run start',
url: 'http://127.0.0.1:3000',
url: 'http://localhost:3000',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
{
command: 'npm run backend',
url: 'http://127.0.0.1:3333',
url: 'http://localhost:3333',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
}
],
use: {
baseURL: 'http://127.0.0.1:3000',
baseURL: 'http://localhost:3000',
},
});
```
Expand Down
2 changes: 1 addition & 1 deletion nodejs/docs/locators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ Consider a page with two buttons, the first invisible and the second [visible](.
* This will only find a second button, because it is visible, and then click it.

```js
await page.locator('button').locator('visible=true').click();
await page.locator('button').visible().click();
```

## Lists
Expand Down
4 changes: 2 additions & 2 deletions nodejs/docs/test-configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default defineConfig({

use: {
// Base URL to use in actions like `await page.goto('/')`.
baseURL: 'http://127.0.0.1:3000',
baseURL: 'http://localhost:3000',

// Collect trace when retrying the failed test.
trace: 'on-first-retry',
Expand All @@ -53,7 +53,7 @@ export default defineConfig({
// Run your local dev server before starting the tests.
webServer: {
command: 'npm run start',
url: 'http://127.0.0.1:3000',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
});
Expand Down
2 changes: 1 addition & 1 deletion nodejs/docs/test-use-options.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { defineConfig } from '@playwright/test';
export default defineConfig({
use: {
// Base URL to use in actions like `await page.goto('/')`.
baseURL: 'http://127.0.0.1:3000',
baseURL: 'http://localhost:3000',

// Populates context with given storage state.
storageState: 'state.json',
Expand Down
18 changes: 9 additions & 9 deletions nodejs/docs/test-webserver.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default defineConfig({
// Run your local dev server before starting the tests
webServer: {
command: 'npm run start',
url: 'http://127.0.0.1:3000',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
stdout: 'ignore',
stderr: 'pipe',
Expand Down Expand Up @@ -55,7 +55,7 @@ export default defineConfig({
// Run your local dev server before starting the tests
webServer: {
command: 'npm run start',
url: 'http://127.0.0.1:3000',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
Expand All @@ -66,7 +66,7 @@ export default defineConfig({

It is also recommended to specify the `baseURL` in the `use: {}` section of your config, so that tests can use relative urls and you don't have to specify the full URL over and over again.

When using [page.goto()](/api/class-page.mdx#page-goto), [page.route()](/api/class-page.mdx#page-route), [page.waitForURL()](/api/class-page.mdx#page-wait-for-url), [page.waitForRequest()](/api/class-page.mdx#page-wait-for-request), or [page.waitForResponse()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. For Example, by setting the baseURL to `http://127.0.0.1:3000` and navigating to `/login` in your tests, Playwright will run the test using `http://127.0.0.1:3000/login`.
When using [page.goto()](/api/class-page.mdx#page-goto), [page.route()](/api/class-page.mdx#page-route), [page.waitForURL()](/api/class-page.mdx#page-wait-for-url), [page.waitForRequest()](/api/class-page.mdx#page-wait-for-request), or [page.waitForResponse()](/api/class-page.mdx#page-wait-for-response) it takes the base URL in consideration by using the [`URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor for building the corresponding URL. For Example, by setting the baseURL to `http://localhost:3000` and navigating to `/login` in your tests, Playwright will run the test using `http://localhost:3000/login`.

```js title="playwright.config.ts"
import { defineConfig } from '@playwright/test';
Expand All @@ -77,11 +77,11 @@ export default defineConfig({
// Run your local dev server before starting the tests
webServer: {
command: 'npm run start',
url: 'http://127.0.0.1:3000',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
use: {
baseURL: 'http://127.0.0.1:3000',
baseURL: 'http://localhost:3000',
},
});
```
Expand All @@ -92,7 +92,7 @@ Now you can use a relative path when navigating the page:
import { test } from '@playwright/test';

test('test', async ({ page }) => {
// This will navigate to http://127.0.0.1:3000/login
// This will navigate to http://localhost:3000/login
await page.goto('./login');
});
```
Expand All @@ -108,19 +108,19 @@ export default defineConfig({
webServer: [
{
command: 'npm run start',
url: 'http://127.0.0.1:3000',
url: 'http://localhost:3000',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
},
{
command: 'npm run backend',
url: 'http://127.0.0.1:3333',
url: 'http://localhost:3333',
timeout: 120 * 1000,
reuseExistingServer: !process.env.CI,
}
],
use: {
baseURL: 'http://127.0.0.1:3000',
baseURL: 'http://localhost:3000',
},
});
```
Expand Down
23 changes: 23 additions & 0 deletions python/docs/api/class-locator.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3134,6 +3134,29 @@ When all steps combined have not finished during the specified [timeout](/api/cl

---

### visible {#locator-visible}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.51</font><x-search>locator.visible</x-search>

Returns a locator that only matches [visible](../actionability.mdx#visible) elements.

**Usage**

```python
locator.visible()
locator.visible(**kwargs)
```

**Arguments**
- `visible` [bool] *(optional)*<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-option-visible"/><a href="#locator-visible-option-visible" class="list-anchor">#</a>

Whether to match visible or invisible elements.

**Returns**
- [Locator]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="locator-visible-return"/><a href="#locator-visible-return" class="list-anchor">#</a>

---

### wait_for {#locator-wait-for}

<font size="2" style={{position: "relative", top: "-20px"}}>Added in: v1.16</font><x-search>locator.wait_for</x-search>
Expand Down
4 changes: 2 additions & 2 deletions python/docs/locators.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1318,14 +1318,14 @@ Consider a page with two buttons, the first invisible and the second [visible](.
<TabItem value="sync">

```py
page.locator("button").locator("visible=true").click()
page.locator("button").visible().click()
```

</TabItem>
<TabItem value="async">

```py
await page.locator("button").locator("visible=true").click()
await page.locator("button").visible().click()
```

</TabItem>
Expand Down
Loading