diff --git a/dotnet/docs/api/class-locator.mdx b/dotnet/docs/api/class-locator.mdx index a81710e91c..aa2142b0fb 100644 --- a/dotnet/docs/api/class-locator.mdx +++ b/dotnet/docs/api/class-locator.mdx @@ -555,7 +555,7 @@ await button.ClickAsync(); Added in: v1.57locator.Description -Returns locator description previously set with [Locator.Describe()](/api/class-locator.mdx#locator-describe). +Returns locator description previously set with [Locator.Describe()](/api/class-locator.mdx#locator-describe). Returns `null` if no custom description has been set. Prefer `Locator.toString()` for a human-readable representation, as it uses the description when available. **Usage** diff --git a/dotnet/docs/api/class-request.mdx b/dotnet/docs/api/class-request.mdx index edb81d78df..28cfc5804e 100644 --- a/dotnet/docs/api/class-request.mdx +++ b/dotnet/docs/api/class-request.mdx @@ -43,6 +43,57 @@ await Request.AllHeadersAsync(); --- +### BodyAsync {#request-body} + +Added in: v1.57request.BodyAsync + +The request body, if present. + +**Usage** + +```csharp +await Request.BodyAsync(); +``` + +**Returns** +- [string]?# + +--- + +### BodyBufferAsync {#request-body-buffer} + +Added in: v1.57request.BodyBufferAsync + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```csharp +await Request.BodyBufferAsync(); +``` + +**Returns** +- [byte][]?# + +--- + +### BodyJSONAsync {#request-body-json} + +Added in: v1.57request.BodyJSONAsync + +Returns the request body as a parsed JSON object. If the request `Content-Type` is `application/x-www-form-urlencoded`, this method returns a key/value object parsed from the form data. Otherwise, it parses the body as JSON. + +**Usage** + +```csharp +await Request.BodyJSONAsync(); +``` + +**Returns** +- [JsonElement]?# + +--- + ### Failure {#request-failure} Added before v1.9request.Failure @@ -188,59 +239,6 @@ Request.Method --- -### PostData {#request-post-data} - -Added before v1.9request.PostData - -Request's post body, if any. - -**Usage** - -```csharp -Request.PostData -``` - -**Returns** -- [string]?# - ---- - -### PostDataBuffer {#request-post-data-buffer} - -Added before v1.9request.PostDataBuffer - -Request's post body in a binary form, if any. - -**Usage** - -```csharp -Request.PostDataBuffer -``` - -**Returns** -- [byte][]?# - ---- - -### PostDataJSON {#request-post-data-json} - -Added in: v1.12request.PostDataJSON - -Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any. - -When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned. Otherwise it will be parsed as JSON. - -**Usage** - -```csharp -Request.PostDataJSON -``` - -**Returns** -- [JsonElement]?# - ---- - ### RedirectedFrom {#request-redirected-from} Added before v1.9request.RedirectedFrom @@ -415,6 +413,80 @@ Request.Url **Returns** - [string]# +--- + +## Deprecated + +### PostData {#request-post-data} + +Added before v1.9request.PostData + +:::warning[Discouraged] + +Use [Request.BodyAsync()](/api/class-request.mdx#request-body) instead. + +::: + + +The request body, if present. + +**Usage** + +```csharp +Request.PostData +``` + +**Returns** +- [string]?# + +--- + +### PostDataBuffer {#request-post-data-buffer} + +Added before v1.9request.PostDataBuffer + +:::warning[Discouraged] + +Use [Request.BodyBufferAsync()](/api/class-request.mdx#request-body-buffer) instead. + +::: + + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```csharp +Request.PostDataBuffer +``` + +**Returns** +- [byte][]?# + +--- + +### PostDataJSON {#request-post-data-json} + +Added in: v1.12request.PostDataJSON + +:::warning[Discouraged] + +Use [Request.BodyJSONAsync()](/api/class-request.mdx#request-body-json) instead. + +::: + + +Returns the request body as a parsed JSON object. If the request `Content-Type` is `application/x-www-form-urlencoded`, this method returns a key/value object parsed from the form data. Otherwise, it parses the body as JSON. + +**Usage** + +```csharp +Request.PostDataJSON +``` + +**Returns** +- [JsonElement]?# + [APIRequest]: /api/class-apirequest.mdx "APIRequest" [APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext" diff --git a/dotnet/docs/ci.mdx b/dotnet/docs/ci.mdx index 7d02295c8b..d0df1c2cc2 100644 --- a/dotnet/docs/ci.mdx +++ b/dotnet/docs/ci.mdx @@ -76,7 +76,7 @@ jobs: name: 'Playwright Tests' runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright/dotnet:v1.55.0-noble + image: mcr.microsoft.com/playwright/dotnet:v1.56.0-noble options: --user 1001 steps: - uses: actions/checkout@v5 @@ -159,7 +159,7 @@ trigger: pool: vmImage: ubuntu-latest -container: mcr.microsoft.com/playwright/dotnet:v1.55.0-noble +container: mcr.microsoft.com/playwright/dotnet:v1.56.0-noble steps: - task: UseDotNet@2 @@ -182,7 +182,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In executors: pw-noble-development: docker: - - image: mcr.microsoft.com/playwright/dotnet:v1.55.0-noble + - image: mcr.microsoft.com/playwright/dotnet:v1.56.0-noble ``` Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures. @@ -193,7 +193,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image]( ```groovy pipeline { - agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v1.55.0-noble' } } + agent { docker { image 'mcr.microsoft.com/playwright/dotnet:v1.56.0-noble' } } stages { stage('e2e-tests') { steps { @@ -210,7 +210,7 @@ pipeline { Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.mdx)). ```yml -image: mcr.microsoft.com/playwright/dotnet:v1.55.0-noble +image: mcr.microsoft.com/playwright/dotnet:v1.56.0-noble ``` ### GitLab CI diff --git a/dotnet/docs/docker.mdx b/dotnet/docs/docker.mdx index ddc0ad5081..db075a24a3 100644 --- a/dotnet/docs/docker.mdx +++ b/dotnet/docs/docker.mdx @@ -22,7 +22,7 @@ This Docker image is intended to be used for testing and development purposes on ### Pull the image ```bash -docker pull mcr.microsoft.com/playwright/dotnet:v1.55.0-noble +docker pull mcr.microsoft.com/playwright/dotnet:v1.56.0-noble ``` ### Run the image @@ -34,7 +34,7 @@ By default, the Docker image will use the `root` user to run the browsers. This On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers. ```bash -docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.55.0-noble /bin/bash +docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.56.0-noble /bin/bash ``` #### Crawling and scraping @@ -42,7 +42,7 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright/dotnet:v1.55.0-noble On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it. ```bash -docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v1.55.0-noble /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/dotnet:v1.56.0-noble /bin/bash ``` [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: @@ -82,7 +82,7 @@ You can run Playwright Server in Docker while keeping your tests running on the Start the Playwright Server in Docker: ```bash -docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.0-noble /bin/sh -c "npx -y playwright@1.55.0 run-server --port 3000 --host 0.0.0.0" +docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.56.0-noble /bin/sh -c "npx -y playwright@1.56.0 run-server --port 3000 --host 0.0.0.0" ``` #### Connecting to the Server @@ -99,7 +99,7 @@ await using var browser = await playwright.Chromium.ConnectAsync("ws://127.0.0.1 If you need to access local servers from within the Docker container: ```bash -docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.0-noble /bin/sh -c "npx -y playwright@1.55.0 run-server --port 3000 --host 0.0.0.0" +docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.56.0-noble /bin/sh -c "npx -y playwright@1.56.0 run-server --port 3000 --host 0.0.0.0" ``` This makes `hostmachine` point to the host's localhost. Your tests should use `hostmachine` instead of `localhost` when accessing local servers. @@ -114,9 +114,9 @@ When running tests remotely, ensure the Playwright version in your tests matches See [all available image tags]. We currently publish images with the following tags: -- `:v1.55.0` - Playwright v1.55.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.55.0-noble` - Playwright v1.55.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.55.0-jammy` - Playwright v1.55.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). +- `:v1.56.0` - Playwright v1.56.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.56.0-noble` - Playwright v1.56.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.56.0-jammy` - Playwright v1.56.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). :::note diff --git a/java/docs/api/class-locator.mdx b/java/docs/api/class-locator.mdx index b40af7d6e5..1bad568342 100644 --- a/java/docs/api/class-locator.mdx +++ b/java/docs/api/class-locator.mdx @@ -556,7 +556,7 @@ button.click(); Added in: v1.57locator.description -Returns locator description previously set with [Locator.describe()](/api/class-locator.mdx#locator-describe). +Returns locator description previously set with [Locator.describe()](/api/class-locator.mdx#locator-describe). Returns `null` if no custom description has been set. Prefer `Locator.toString()` for a human-readable representation, as it uses the description when available. **Usage** diff --git a/java/docs/api/class-request.mdx b/java/docs/api/class-request.mdx index 11d2f87c35..4f9609de77 100644 --- a/java/docs/api/class-request.mdx +++ b/java/docs/api/class-request.mdx @@ -43,6 +43,40 @@ Request.allHeaders(); --- +### body {#request-body} + +Added in: v1.57request.body + +The request body, if present. + +**Usage** + +```java +Request.body(); +``` + +**Returns** +- [null] | [String]# + +--- + +### bodyBuffer {#request-body-buffer} + +Added in: v1.57request.bodyBuffer + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```java +Request.bodyBuffer(); +``` + +**Returns** +- [null] | [byte[]]# + +--- + ### failure {#request-failure} Added before v1.9request.failure @@ -187,40 +221,6 @@ Request.method(); --- -### postData {#request-post-data} - -Added before v1.9request.postData - -Request's post body, if any. - -**Usage** - -```java -Request.postData(); -``` - -**Returns** -- [null] | [String]# - ---- - -### postDataBuffer {#request-post-data-buffer} - -Added before v1.9request.postDataBuffer - -Request's post body in a binary form, if any. - -**Usage** - -```java -Request.postDataBuffer(); -``` - -**Returns** -- [null] | [byte[]]# - ---- - ### redirectedFrom {#request-redirected-from} Added before v1.9request.redirectedFrom @@ -395,6 +395,56 @@ Request.url(); **Returns** - [String]# +--- + +## Deprecated + +### postData {#request-post-data} + +Added before v1.9request.postData + +:::warning[Discouraged] + +Use [Request.body()](/api/class-request.mdx#request-body) instead. + +::: + + +The request body, if present. + +**Usage** + +```java +Request.postData(); +``` + +**Returns** +- [null] | [String]# + +--- + +### postDataBuffer {#request-post-data-buffer} + +Added before v1.9request.postDataBuffer + +:::warning[Discouraged] + +Use [Request.bodyBuffer()](/api/class-request.mdx#request-body-buffer) instead. + +::: + + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```java +Request.postDataBuffer(); +``` + +**Returns** +- [null] | [byte[]]# + [APIRequest]: /api/class-apirequest.mdx "APIRequest" [APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext" diff --git a/nodejs/docs/api/class-locator.mdx b/nodejs/docs/api/class-locator.mdx index 9ba8d3a1f7..341eb2f8cc 100644 --- a/nodejs/docs/api/class-locator.mdx +++ b/nodejs/docs/api/class-locator.mdx @@ -557,7 +557,7 @@ await button.click(); Added in: v1.57locator.description -Returns locator description previously set with [locator.describe()](/api/class-locator.mdx#locator-describe). +Returns locator description previously set with [locator.describe()](/api/class-locator.mdx#locator-describe). Returns `null` if no custom description has been set. Prefer `Locator.toString()` for a human-readable representation, as it uses the description when available. **Usage** diff --git a/nodejs/docs/api/class-request.mdx b/nodejs/docs/api/class-request.mdx index 18b9c4b6eb..ac7974787b 100644 --- a/nodejs/docs/api/class-request.mdx +++ b/nodejs/docs/api/class-request.mdx @@ -43,6 +43,57 @@ await request.allHeaders(); --- +### body {#request-body} + +Added in: v1.57request.body + +The request body, if present. + +**Usage** + +```js +await request.body(); +``` + +**Returns** +- [Promise]<[null] | [string]># + +--- + +### bodyBuffer {#request-body-buffer} + +Added in: v1.57request.bodyBuffer + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```js +await request.bodyBuffer(); +``` + +**Returns** +- [Promise]<[null] | [Buffer]># + +--- + +### bodyJSON {#request-body-json} + +Added in: v1.57request.bodyJSON + +Returns the request body as a parsed JSON object. If the request `Content-Type` is `application/x-www-form-urlencoded`, this method returns a key/value object parsed from the form data. Otherwise, it parses the body as JSON. + +**Usage** + +```js +await request.bodyJSON(); +``` + +**Returns** +- [Promise]<[null] | [Serializable]># + +--- + ### failure {#request-failure} Added before v1.9request.failure @@ -199,59 +250,6 @@ request.method(); --- -### postData {#request-post-data} - -Added before v1.9request.postData - -Request's post body, if any. - -**Usage** - -```js -request.postData(); -``` - -**Returns** -- [null] | [string]# - ---- - -### postDataBuffer {#request-post-data-buffer} - -Added before v1.9request.postDataBuffer - -Request's post body in a binary form, if any. - -**Usage** - -```js -request.postDataBuffer(); -``` - -**Returns** -- [null] | [Buffer]# - ---- - -### postDataJSON {#request-post-data-json} - -Added before v1.9request.postDataJSON - -Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any. - -When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned. Otherwise it will be parsed as JSON. - -**Usage** - -```js -request.postDataJSON(); -``` - -**Returns** -- [null] | [Serializable]# - ---- - ### redirectedFrom {#request-redirected-from} Added before v1.9request.redirectedFrom @@ -448,6 +446,80 @@ request.url(); **Returns** - [string]# +--- + +## Deprecated + +### postData {#request-post-data} + +Added before v1.9request.postData + +:::warning[Discouraged] + +Use [request.body()](/api/class-request.mdx#request-body) instead. + +::: + + +The request body, if present. + +**Usage** + +```js +request.postData(); +``` + +**Returns** +- [null] | [string]# + +--- + +### postDataBuffer {#request-post-data-buffer} + +Added before v1.9request.postDataBuffer + +:::warning[Discouraged] + +Use [request.bodyBuffer()](/api/class-request.mdx#request-body-buffer) instead. + +::: + + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```js +request.postDataBuffer(); +``` + +**Returns** +- [null] | [Buffer]# + +--- + +### postDataJSON {#request-post-data-json} + +Added before v1.9request.postDataJSON + +:::warning[Discouraged] + +Use [request.bodyJSON()](/api/class-request.mdx#request-body-json) instead. + +::: + + +Returns the request body as a parsed JSON object. If the request `Content-Type` is `application/x-www-form-urlencoded`, this method returns a key/value object parsed from the form data. Otherwise, it parses the body as JSON. + +**Usage** + +```js +request.postDataJSON(); +``` + +**Returns** +- [null] | [Serializable]# + [Android]: /api/class-android.mdx "Android" [AndroidDevice]: /api/class-androiddevice.mdx "AndroidDevice" diff --git a/nodejs/docs/ci.mdx b/nodejs/docs/ci.mdx index 1720ed06c2..9a7e00f37e 100644 --- a/nodejs/docs/ci.mdx +++ b/nodejs/docs/ci.mdx @@ -64,7 +64,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - - uses: actions/setup-node@v5 + - uses: actions/setup-node@v6 with: node-version: lts/* - name: Install dependencies @@ -73,7 +73,7 @@ jobs: run: npx playwright install --with-deps - name: Run Playwright tests run: npx playwright test - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v5 if: ${{ !cancelled() }} with: name: playwright-report @@ -105,7 +105,7 @@ jobs: options: --user 1001 steps: - uses: actions/checkout@v5 - - uses: actions/setup-node@v5 + - uses: actions/setup-node@v6 with: node-version: lts/* - name: Install dependencies @@ -129,7 +129,7 @@ jobs: if: github.event.deployment_status.state == 'success' steps: - uses: actions/checkout@v5 - - uses: actions/setup-node@v5 + - uses: actions/setup-node@v6 with: node-version: lts/* - name: Install dependencies @@ -163,7 +163,7 @@ jobs: # Force a non-shallow checkout, so that we can reference $GITHUB_BASE_REF. # See https://github.com/actions/checkout for more details. fetch-depth: 0 - - uses: actions/setup-node@v5 + - uses: actions/setup-node@v6 with: node-version: lts/* - name: Install dependencies @@ -175,7 +175,7 @@ jobs: if: github.event_name == 'pull_request' - name: Run Playwright tests run: npx playwright test - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v5 if: ${{ !cancelled() }} with: name: playwright-report diff --git a/nodejs/docs/intro.mdx b/nodejs/docs/intro.mdx index aa125cbd5f..62ab626b18 100644 --- a/nodejs/docs/intro.mdx +++ b/nodejs/docs/intro.mdx @@ -74,13 +74,11 @@ package.json package-lock.json # Or yarn.lock / pnpm-lock.yaml tests/ example.spec.ts # Minimal example test -tests-examples/ - demo-todo-app.spec.ts # Richer example tests ``` The [playwright.config](./test-configuration.mdx) centralizes configuration: target browsers, timeouts, retries, projects, reporters and more. In existing projects dependencies are added to your current `package.json`. -`tests/` contains a minimal starter test. `tests-examples/` provides richer samples (e.g. a todo app) to explore patterns. +`tests/` contains a minimal starter test. ## Running the Example Test diff --git a/python/docs/api/class-locator.mdx b/python/docs/api/class-locator.mdx index 652e2bada3..b59aa848b2 100644 --- a/python/docs/api/class-locator.mdx +++ b/python/docs/api/class-locator.mdx @@ -3321,7 +3321,7 @@ await frame_locator.get_by_role("button").click() Added in: v1.57locator.description -Returns locator description previously set with [locator.describe()](/api/class-locator.mdx#locator-describe). +Returns locator description previously set with [locator.describe()](/api/class-locator.mdx#locator-describe). Returns `null` if no custom description has been set. Prefer `Locator.toString()` for a human-readable representation, as it uses the description when available. **Usage** diff --git a/python/docs/api/class-request.mdx b/python/docs/api/class-request.mdx index 6f047b19a3..e14ac2ae29 100644 --- a/python/docs/api/class-request.mdx +++ b/python/docs/api/class-request.mdx @@ -43,6 +43,57 @@ request.all_headers() --- +### body {#request-body} + +Added in: v1.57request.body + +The request body, if present. + +**Usage** + +```python +request.body() +``` + +**Returns** +- [NoneType] | [str]# + +--- + +### body_buffer {#request-body-buffer} + +Added in: v1.57request.body_buffer + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```python +request.body_buffer() +``` + +**Returns** +- [NoneType] | [bytes]# + +--- + +### body_json {#request-body-json} + +Added in: v1.57request.body_json + +Returns the request body as a parsed JSON object. If the request `Content-Type` is `application/x-www-form-urlencoded`, this method returns a key/value object parsed from the form data. Otherwise, it parses the body as JSON. + +**Usage** + +```python +request.body_json() +``` + +**Returns** +- [NoneType] | [Dict]# + +--- + ### header_value {#request-header-value} Added in: v1.15request.header_value @@ -233,59 +284,6 @@ request.method --- -### post_data {#request-post-data} - -Added before v1.9request.post_data - -Request's post body, if any. - -**Usage** - -```python -request.post_data -``` - -**Returns** -- [NoneType] | [str]# - ---- - -### post_data_buffer {#request-post-data-buffer} - -Added before v1.9request.post_data_buffer - -Request's post body in a binary form, if any. - -**Usage** - -```python -request.post_data_buffer -``` - -**Returns** -- [NoneType] | [bytes]# - ---- - -### post_data_json {#request-post-data-json} - -Added before v1.9request.post_data_json - -Returns parsed request's body for `form-urlencoded` and JSON as a fallback if any. - -When the response is `application/x-www-form-urlencoded` then a key/value object of the values will be returned. Otherwise it will be parsed as JSON. - -**Usage** - -```python -request.post_data_json -``` - -**Returns** -- [NoneType] | [Dict]# - ---- - ### redirected_from {#request-redirected-from} Added before v1.9request.redirected_from @@ -478,6 +476,80 @@ request.url **Returns** - [str]# +--- + +## Deprecated + +### post_data {#request-post-data} + +Added before v1.9request.post_data + +:::warning[Discouraged] + +Use [request.body()](/api/class-request.mdx#request-body) instead. + +::: + + +The request body, if present. + +**Usage** + +```python +request.post_data +``` + +**Returns** +- [NoneType] | [str]# + +--- + +### post_data_buffer {#request-post-data-buffer} + +Added before v1.9request.post_data_buffer + +:::warning[Discouraged] + +Use [request.body_buffer()](/api/class-request.mdx#request-body-buffer) instead. + +::: + + +The request body in a binary form. Returns null if the request has no body. + +**Usage** + +```python +request.post_data_buffer +``` + +**Returns** +- [NoneType] | [bytes]# + +--- + +### post_data_json {#request-post-data-json} + +Added before v1.9request.post_data_json + +:::warning[Discouraged] + +Use [request.body_json()](/api/class-request.mdx#request-body-json) instead. + +::: + + +Returns the request body as a parsed JSON object. If the request `Content-Type` is `application/x-www-form-urlencoded`, this method returns a key/value object parsed from the form data. Otherwise, it parses the body as JSON. + +**Usage** + +```python +request.post_data_json +``` + +**Returns** +- [NoneType] | [Dict]# + [APIRequest]: /api/class-apirequest.mdx "APIRequest" [APIRequestContext]: /api/class-apirequestcontext.mdx "APIRequestContext" diff --git a/python/docs/ci.mdx b/python/docs/ci.mdx index 92197b8820..398dcc9b3a 100644 --- a/python/docs/ci.mdx +++ b/python/docs/ci.mdx @@ -60,7 +60,7 @@ jobs: run: python -m playwright install --with-deps - name: Run your tests run: pytest --tracing=retain-on-failure - - uses: actions/upload-artifact@v4 + - uses: actions/upload-artifact@v5 if: ${{ !cancelled() }} with: name: playwright-traces @@ -83,7 +83,7 @@ jobs: name: 'Playwright Tests' runs-on: ubuntu-latest container: - image: mcr.microsoft.com/playwright/python:v1.55.0-noble + image: mcr.microsoft.com/playwright/python:v1.56.0-noble options: --user 1001 steps: - uses: actions/checkout@v5 @@ -173,7 +173,7 @@ trigger: pool: vmImage: ubuntu-latest -container: mcr.microsoft.com/playwright/python:v1.55.0-noble +container: mcr.microsoft.com/playwright/python:v1.56.0-noble steps: - task: UsePythonVersion@0 @@ -197,7 +197,7 @@ Running Playwright on CircleCI is very similar to running on GitHub Actions. In executors: pw-noble-development: docker: - - image: mcr.microsoft.com/playwright/python:v1.55.0-noble + - image: mcr.microsoft.com/playwright/python:v1.56.0-noble ``` Note: When using the docker agent definition, you are specifying the resource class of where playwright runs to the 'medium' tier [here](https://circleci.com/docs/configuration-reference?#docker-execution-environment). The default behavior of Playwright is to set the number of workers to the detected core count (2 in the case of the medium tier). Overriding the number of workers to greater than this number will cause unnecessary timeouts and failures. @@ -208,7 +208,7 @@ Jenkins supports Docker agents for pipelines. Use the [Playwright Docker image]( ```groovy pipeline { - agent { docker { image 'mcr.microsoft.com/playwright/python:v1.55.0-noble' } } + agent { docker { image 'mcr.microsoft.com/playwright/python:v1.56.0-noble' } } stages { stage('e2e-tests') { steps { @@ -225,7 +225,7 @@ pipeline { Bitbucket Pipelines can use public [Docker images as build environments](https://confluence.atlassian.com/bitbucket/use-docker-images-as-build-environments-792298897.html). To run Playwright tests on Bitbucket, use our public Docker image ([see Dockerfile](./docker.mdx)). ```yml -image: mcr.microsoft.com/playwright/python:v1.55.0-noble +image: mcr.microsoft.com/playwright/python:v1.56.0-noble ``` ### GitLab CI @@ -238,7 +238,7 @@ stages: tests: stage: test - image: mcr.microsoft.com/playwright/python:v1.55.0-noble + image: mcr.microsoft.com/playwright/python:v1.56.0-noble script: ... ``` diff --git a/python/docs/docker.mdx b/python/docs/docker.mdx index bee494934a..afb776042f 100644 --- a/python/docs/docker.mdx +++ b/python/docs/docker.mdx @@ -22,7 +22,7 @@ This Docker image is intended to be used for testing and development purposes on ### Pull the image ```bash -docker pull mcr.microsoft.com/playwright/python:v1.55.0-noble +docker pull mcr.microsoft.com/playwright/python:v1.56.0-noble ``` ### Run the image @@ -34,7 +34,7 @@ By default, the Docker image will use the `root` user to run the browsers. This On trusted websites, you can avoid creating a separate user and use root for it since you trust the code which will run on the browsers. ```bash -docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v1.55.0-noble /bin/bash +docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v1.56.0-noble /bin/bash ``` #### Crawling and scraping @@ -42,7 +42,7 @@ docker run -it --rm --ipc=host mcr.microsoft.com/playwright/python:v1.55.0-noble On untrusted websites, it's recommended to use a separate user for launching the browsers in combination with the seccomp profile. Inside the container or if you are using the Docker image as a base image you have to use `adduser` for it. ```bash -docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v1.55.0-noble /bin/bash +docker run -it --rm --ipc=host --user pwuser --security-opt seccomp=seccomp_profile.json mcr.microsoft.com/playwright/python:v1.56.0-noble /bin/bash ``` [`seccomp_profile.json`](https://github.com/microsoft/playwright/blob/main/utils/docker/seccomp_profile.json) is needed to run Chromium with sandbox. This is a [default Docker seccomp profile](https://github.com/docker/engine/blob/d0d99b04cf6e00ed3fc27e81fc3d94e7eda70af3/profiles/seccomp/default.json) with extra user namespace cloning permissions: @@ -82,7 +82,7 @@ You can run Playwright Server in Docker while keeping your tests running on the Start the Playwright Server in Docker: ```bash -docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.0-noble /bin/sh -c "npx -y playwright@1.55.0 run-server --port 3000 --host 0.0.0.0" +docker run -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.56.0-noble /bin/sh -c "npx -y playwright@1.56.0 run-server --port 3000 --host 0.0.0.0" ``` #### Connecting to the Server @@ -122,7 +122,7 @@ async with async_playwright() as p: If you need to access local servers from within the Docker container: ```bash -docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.55.0-noble /bin/sh -c "npx -y playwright@1.55.0 run-server --port 3000 --host 0.0.0.0" +docker run --add-host=hostmachine:host-gateway -p 3000:3000 --rm --init -it --workdir /home/pwuser --user pwuser mcr.microsoft.com/playwright:v1.56.0-noble /bin/sh -c "npx -y playwright@1.56.0 run-server --port 3000 --host 0.0.0.0" ``` This makes `hostmachine` point to the host's localhost. Your tests should use `hostmachine` instead of `localhost` when accessing local servers. @@ -137,9 +137,9 @@ When running tests remotely, ensure the Playwright version in your tests matches See [all available image tags]. We currently publish images with the following tags: -- `:v1.55.0` - Playwright v1.55.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.55.0-noble` - Playwright v1.55.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). -- `:v1.55.0-jammy` - Playwright v1.55.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). +- `:v1.56.0` - Playwright v1.56.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.56.0-noble` - Playwright v1.56.0 release docker image based on Ubuntu 24.04 LTS (Noble Numbat). +- `:v1.56.0-jammy` - Playwright v1.56.0 release docker image based on Ubuntu 22.04 LTS (Jammy Jellyfish). :::note @@ -163,7 +163,7 @@ To run Playwright inside Docker, you need to have Python, [Playwright browsers]( ```Dockerfile FROM python:3.12-bookworm -RUN pip install playwright==@1.55.0 && \ +RUN pip install playwright==@1.56.0 && \ playwright install --with-deps ```