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
2 changes: 1 addition & 1 deletion dotnet/docs/api/class-consolemessage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ ConsoleMessage.Type
```

**Returns**
- `enum ConsoleMessageType { Log, Debug, Info, Error, Warning, Dir, Dirxml, Table, Trace, Clear, StartGroup, StartGroupCollapsed, EndGroup, Assert, Profile, ProfileEnd, Count, TimeEnd }`<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>
- [string]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>


[Accessibility]: /api/class-accessibility.mdx "Accessibility"
Expand Down
2 changes: 1 addition & 1 deletion java/docs/api/class-consolemessage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ ConsoleMessage.type();
```

**Returns**
- `enum ConsoleMessageType { LOG, DEBUG, INFO, ERROR, WARNING, DIR, DIRXML, TABLE, TRACE, CLEAR, STARTGROUP, STARTGROUPCOLLAPSED, ENDGROUP, ASSERT, PROFILE, PROFILEEND, COUNT, TIMEEND }`<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>
- [String]<a aria-hidden="true" tabIndex="-1" class="list-anchor-link" id="console-message-type-return"/><a href="#console-message-type-return" class="list-anchor">#</a>


[APIRequest]: /api/class-apirequest.mdx "APIRequest"
Expand Down
3 changes: 0 additions & 3 deletions nodejs/docs/api/class-browsercontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -899,9 +899,6 @@ await browserContext.storageState(options);
- `sameSite` "Strict" | "Lax" | "None"


- `partitionKey` [string] *(optional)*



- `origins` [Array]&lt;[Object]&gt;
- `origin` [string]
Expand Down
2 changes: 0 additions & 2 deletions nodejs/docs/api/class-consolemessage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,6 @@ consoleMessage.text();

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>consoleMessage.type</x-search>

One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.

**Usage**

```js
Expand Down
25 changes: 9 additions & 16 deletions nodejs/docs/chrome-extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import HTMLCard from '@site/src/components/HTMLCard';
Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality.
:::

The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`.
The snippet below retrieves the [service worker](https://developer.chrome.com/docs/extensions/develop/concepts/service-workers) of a [Manifest v3](https://developer.chrome.com/docs/extensions/develop/migrate) extension whose source is located in `./my-extension`.

Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode.

Expand All @@ -30,11 +30,11 @@ const { chromium } = require('playwright');
`--load-extension=${pathToExtension}`
]
});
let [backgroundPage] = browserContext.backgroundPages();
if (!backgroundPage)
backgroundPage = await browserContext.waitForEvent('backgroundpage');
let [serviceWorker] = browserContext.serviceWorkers();
if (!serviceWorker)
serviceWorker = await browserContext.waitForEvent('serviceworker');

// Test the background page as you would any other page.
// Test the service worker as you would any other worker.
await browserContext.close();
})();
```
Expand Down Expand Up @@ -68,19 +68,12 @@ export const test = base.extend<{
await context.close();
},
extensionId: async ({ context }, use) => {
/*
// for manifest v2:
let [background] = context.backgroundPages()
if (!background)
background = await context.waitForEvent('backgroundpage')
*/

// for manifest v3:
let [background] = context.serviceWorkers();
if (!background)
background = await context.waitForEvent('serviceworker');
let [serviceWorker] = context.serviceWorkers();
if (!serviceWorker)
serviceWorker = await context.waitForEvent('serviceworker');

const extensionId = background.url().split('/')[2];
const extensionId = serviceWorker.url().split('/')[2];
await use(extensionId);
},
});
Expand Down
14 changes: 11 additions & 3 deletions nodejs/docs/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ Playwright Test was created specifically to accommodate the needs of end-to-end

## Installing Playwright

Get started by installing Playwright using npm, yarn or pnpm. Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.mdx).
Get started by installing Playwright using one of the following methods.

### Using npm, yarn or pnpm

The command below either initializes a new project with Playwright, or adds Playwright setup to your current project.

<Tabs groupId="js-package-manager" defaultValue="npm" values={[ {label: 'npm', value: 'npm'}, {label: 'yarn', value: 'yarn'}, {label: 'pnpm', value: 'pnpm'} ] }>

Expand Down Expand Up @@ -50,10 +54,14 @@ pnpm create playwright

Run the install command and select the following to get started:
- Choose between TypeScript or JavaScript (default is TypeScript)
- Name of your Tests folder (default is tests or e2e if you already have a tests folder in your project)
- Name of your Tests folder (default is `tests`, or `e2e` if you already have a `tests` folder in your project)
- Add a GitHub Actions workflow to easily run tests on CI
- Install Playwright browsers (default is true)

### Using the VS Code Extension

Alternatively you can also get started and run your tests using the [VS Code Extension](./getting-started-vscode.mdx).

## What's Installed

Playwright will download the browsers needed as well as create the following files.
Expand Down Expand Up @@ -245,7 +253,7 @@ pnpm exec playwright --version
</Tabs>

## System requirements
- Latest version of Node.js 18, 20 or 22.
- Latest version of Node.js 20, 22 or 24.
- Windows 10+, Windows Server 2016+ or Windows Subsystem for Linux (WSL).
- macOS 14 Ventura, or later.
- Debian 12, Ubuntu 22.04, Ubuntu 24.04, on x86-64 and arm64 architecture.
Expand Down
1 change: 1 addition & 0 deletions nodejs/docs/test-reporters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ HTML report supports the following configuration options and environment variabl
| `PLAYWRIGHT_HTML_HOST` | `host` | When report opens in the browser, it will be served bound to this hostname. | `localhost`
| `PLAYWRIGHT_HTML_PORT` | `port` | When report opens in the browser, it will be served on this port. | `9323` or any available port when `9323` is not available.
| `PLAYWRIGHT_HTML_ATTACHMENTS_BASE_URL` | `attachmentsBaseURL` | A separate location where attachments from the `data` subdirectory are uploaded. Only needed when you upload report and `data` separately to different locations. | `data/`
| `PLAYWRIGHT_HTML_NO_SNIPPETS` | `noSnippets` | If true, disable rendering code snippets in the action log. If there is a top level error, that report section with code snippet will still render. Supports `true`, `1`, `false`, and `0`. | `false`

### Blob reporter

Expand Down
3 changes: 0 additions & 3 deletions python/docs/api/class-browsercontext.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1227,9 +1227,6 @@ browser_context.storage_state(**kwargs)
- `sameSite` "Strict" | "Lax" | "None"


- `partitionKey` [str] *(optional)*



- `origins` [List]\[[Dict]\]
- `origin` [str]
Expand Down
2 changes: 0 additions & 2 deletions python/docs/api/class-consolemessage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,6 @@ console_message.text

<font size="2" style={{position: "relative", top: "-20px"}}>Added before v1.9</font><x-search>consoleMessage.type</x-search>

One of the following values: `'log'`, `'debug'`, `'info'`, `'error'`, `'warning'`, `'dir'`, `'dirxml'`, `'table'`, `'trace'`, `'clear'`, `'startGroup'`, `'startGroupCollapsed'`, `'endGroup'`, `'assert'`, `'profile'`, `'profileEnd'`, `'count'`, `'timeEnd'`.

**Usage**

```python
Expand Down
31 changes: 13 additions & 18 deletions python/docs/chrome-extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import HTMLCard from '@site/src/components/HTMLCard';
Extensions only work in Chrome / Chromium launched with a persistent context. Use custom browser args at your own risk, as some of them may break Playwright functionality.
:::

The snippet below retrieves the [background page](https://developer.chrome.com/extensions/background_pages) of a [Manifest v2](https://developer.chrome.com/docs/extensions/mv2/) extension whose source is located in `./my-extension`.
The snippet below retrieves the [service worker](https://developer.chrome.com/docs/extensions/develop/concepts/service-workers) of a [Manifest v3](https://developer.chrome.com/docs/extensions/develop/migrate) extension whose source is located in `./my-extension`.

Note the use of the `chromium` channel that allows to run extensions in headless mode. Alternatively, you can launch the browser in headed mode.

Expand Down Expand Up @@ -43,12 +43,12 @@ def run(playwright: Playwright):
f"--load-extension={path_to_extension}",
],
)
if len(context.background_pages) == 0:
background_page = context.wait_for_event('backgroundpage')
if len(context.service_workers) == 0:
service_worker = context.wait_for_event('serviceworker')
else:
background_page = context.background_pages[0]
service_worker = context.service_workers[0]

# Test the background page as you would any other page.
# Test the service worker as you would any other worker.
context.close()


Expand Down Expand Up @@ -77,12 +77,12 @@ async def run(playwright: Playwright):
],
)

if len(context.background_pages) == 0:
background_page = await context.wait_for_event('backgroundpage')
if len(context.service_workers) == 0:
service_worker = await context.wait_for_event('serviceworker')
else:
background_page = context.background_pages[0]
service_worker = context.service_workers[0]

# Test the background page as you would any other page.
# Test the service worker as you would any other worker.
await context.close()


Expand Down Expand Up @@ -129,17 +129,12 @@ def context(playwright: Playwright) -> Generator[BrowserContext, None, None]:

@pytest.fixture()
def extension_id(context) -> Generator[str, None, None]:
# for manifest v2:
# background = context.background_pages[0]
# if not background:
# background = context.wait_for_event("backgroundpage")

# for manifest v3:
background = context.service_workers[0]
if not background:
background = context.wait_for_event("serviceworker")
service_worker = context.service_workers[0]
if not service_worker:
service_worker = context.wait_for_event("serviceworker")

extension_id = background.url.split("/")[2]
extension_id = service_worker.url.split("/")[2]
yield extension_id

```
Expand Down
Loading