diff --git a/docs/src/auth.md b/docs/src/auth.md index df03d89c60..6600846773 100644 --- a/docs/src/auth.md +++ b/docs/src/auth.md @@ -256,7 +256,7 @@ existing authentication state instead. Playwright provides a way to reuse the signed-in state in the tests. That way you can log in only once and then skip the log in step for all of the tests. -Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). Playwright provides [browserContext.storageState([options])](https://playwright.dev/docs/api/class-browsercontext#browser-context-storage-state) method that can be used to retrieve storage state from authenticated contexts and then create new contexts with pre-populated state. +Web apps use cookie-based or token-based authentication, where authenticated state is stored as [cookies](https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies) or in [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Storage). Playwright provides [`method: BrowserContext.storageState`] method that can be used to retrieve storage state from authenticated contexts and then create new contexts with pre-populated state. Cookies and local storage state can be used across different browsers. They depend on your application's authentication model: some apps might require both cookies and local storage. diff --git a/docs/src/release-notes-csharp.md b/docs/src/release-notes-csharp.md index b562b982bd..edc12f0a75 100644 --- a/docs/src/release-notes-csharp.md +++ b/docs/src/release-notes-csharp.md @@ -4,6 +4,45 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.42 + +### New Locator Handler + +New method [`method: Page.addLocatorHandler`] registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears. + +```csharp +// Setup the handler. +await Page.AddLocatorHandlerAsync( + Page.GetByRole(AriaRole.Heading, new() { Name = "Hej! You are in control of your cookies." }), + async () => + { + await Page.GetByRole(AriaRole.Button, new() { Name = "Accept all" }).ClickAsync(); + }); +// Write the test as usual. +await Page.GotoAsync("https://www.ikea.com/"); +await Page.GetByRole(AriaRole.Link, new() { Name = "Collection of blue and white" }).ClickAsync(); +await Expect(Page.GetByRole(AriaRole.Heading, new() { Name = "Light and easy" })).ToBeVisibleAsync(); +``` + +### New APIs + +- [`method: Page.pdf`] accepts two new options [`option: tagged`] and [`option: outline`]. + +### Announcements + +* ⚠️ Ubuntu 18 is not supported anymore. + +### Browser Versions + +* Chromium 121.0.6167.57 +* Mozilla Firefox 121.0 +* WebKit 17.4 + +This version was also tested against the following stable channels: + +* Google Chrome 120 +* Microsoft Edge 120 + ## Version 1.41 ### New APIs @@ -511,7 +550,7 @@ This version was also tested against the following stable channels: ### New .runsettings file support -`Microsoft.Playwright.NUnit` and `Microsoft.Playwright.MSTest` will now consider the `.runsettings` file and passed settings via the CLI when running end-to-end tests. See in the [documentation](https://playwright.dev/dotnet/docs/test-runners) for a full list of supported settings. +`Microsoft.Playwright.NUnit` and `Microsoft.Playwright.MSTest` will now consider the `.runsettings` file and passed settings via the CLI when running end-to-end tests. See in the [documentation](./test-runners) for a full list of supported settings. The following does now work: @@ -574,7 +613,7 @@ Linux support looks like this: ### New introduction docs -We rewrote our Getting Started docs to be more end-to-end testing focused. Check them out on [playwright.dev](https://playwright.dev/dotnet/docs/intro). +We rewrote our Getting Started docs to be more end-to-end testing focused. Check them out on [playwright.dev](./intro). ## Version 1.23 @@ -952,31 +991,31 @@ This version of Playwright was also tested against the following stable channels ### 🖱️ Mouse Wheel -By using [`Page.Mouse.WheelAsync`](https://playwright.dev/dotnet/docs/next/api/class-mouse#mouse-wheel) you are now able to scroll vertically or horizontally. +By using [`method: Mouse.wheel`] you are now able to scroll vertically or horizontally. ### 📜 New Headers API Previously it was not possible to get multiple header values of a response. This is now possible and additional helper functions are available: -- [Request.AllHeadersAsync()](https://playwright.dev/dotnet/docs/next/api/class-request#request-all-headers) -- [Request.HeadersArrayAsync()](https://playwright.dev/dotnet/docs/next/api/class-request#request-headers-array) -- [Request.HeaderValueAsync(name: string)](https://playwright.dev/dotnet/docs/next/api/class-request#request-header-value) -- [Response.AllHeadersAsync()](https://playwright.dev/dotnet/docs/next/api/class-response#response-all-headers) -- [Response.HeadersArrayAsync()](https://playwright.dev/dotnet/docs/next/api/class-response#response-headers-array) -- [Response.HeaderValueAsync(name: string)](https://playwright.dev/dotnet/docs/next/api/class-response#response-header-value) -- [Response.HeaderValuesAsync(name: string)](https://playwright.dev/dotnet/docs/next/api/class-response#response-header-values) +- [`method: Request.allHeaders`] +- [`method: Request.headersArray`] +- [`method: Request.headerValue`] +- [`method: Response.allHeaders`] +- [`method: Response.headersArray`] +- [`method: Response.headerValue`] +- [`method: Response.headerValues`] ### 🌈 Forced-Colors emulation -Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [context options](https://playwright.dev/dotnet/docs/next/api/class-browser#browser-new-context-option-forced-colors) or calling [Page.EmulateMediaAsync()](https://playwright.dev/dotnet/docs/next/api/class-page#page-emulate-media). +Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [`method: Browser.newContext`] or calling [`method: Page.emulateMedia`]. ### New APIs -- [Page.RouteAsync()](https://playwright.dev/dotnet/docs/next/api/class-page#page-route) accepts new `times` option to specify how many times this route should be matched. -- [Page.SetCheckedAsync(selector: string, checked: Boolean)](https://playwright.dev/dotnet/docs/next/api/class-page#page-set-checked) and [Locator.SetCheckedAsync(selector: string, checked: Boolean)](https://playwright.dev/dotnet/docs/next/api/class-locator#locator-set-checked) was introduced to set the checked state of a checkbox. -- [Request.SizesAsync()](https://playwright.dev/dotnet/docs/next/api/class-request#request-sizes) Returns resource size information for given http request. -- [Tracing.StartChunkAsync()](https://playwright.dev/dotnet/docs/next/api/class-tracing#tracing-start-chunk) - Start a new trace chunk. -- [Tracing.StopChunkAsync()](https://playwright.dev/dotnet/docs/next/api/class-tracing#tracing-stop-chunk) - Stops a new trace chunk. +- [`method: Page.route`] accepts new `times` option to specify how many times this route should be matched. +- [`method: Page.setChecked`] and [`method: Locator.setChecked`] were introduced to set the checked state of a checkbox. +- [`method: Request.sizes`] Returns resource size information for given http request. +- [`method: Tracing.startChunk`] - Start a new trace chunk. +- [`method: Tracing.stopChunk`] - Stops a new trace chunk. ### Important ⚠ * ⬆ .NET Core Apps 2.1 are **no longer** supported for our CLI tooling. As of August 31st, 2021, .NET Core 2.1 is no [longer supported](https://devblogs.microsoft.com/dotnet/net-core-2-1-will-reach-end-of-support-on-august-21-2021/) and will not receive any security updates. We've decided to move the CLI forward and require .NET Core 3.1 as a minimum. diff --git a/docs/src/release-notes-java.md b/docs/src/release-notes-java.md index 387dda000a..5029f2bc88 100644 --- a/docs/src/release-notes-java.md +++ b/docs/src/release-notes-java.md @@ -4,6 +4,44 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.42 + +### New Locator Handler + +New method [`method: Page.addLocatorHandler`] registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears. + +```java +// Setup the handler. +page.addLocatorHandler( + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Hej! You are in control of your cookies.")), + () - > { + page.getByRole(AriaRole.BUTTON, new Page.GetByRoleOptions().setName("Accept all")).click(); + }); +// Write the test as usual. +page.navigate("https://www.ikea.com/"); +page.getByRole(AriaRole.LINK, new Page.GetByRoleOptions().setName("Collection of blue and white")).click(); +assertThat(page.getByRole(AriaRole.HEADING, new Page.GetByRoleOptions().setName("Light and easy"))).isVisible(); +``` + +### New APIs + +- [`method: Page.pdf`] accepts two new options [`option: tagged`] and [`option: outline`]. + +### Announcements + +* ⚠️ Ubuntu 18 is not supported anymore. + +### Browser Versions + +* Chromium 121.0.6167.57 +* Mozilla Firefox 121.0 +* WebKit 17.4 + +This version was also tested against the following stable channels: + +* Google Chrome 120 +* Microsoft Edge 120 + ## Version 1.41 ### New APIs @@ -931,31 +969,31 @@ This version of Playwright was also tested against the following stable channels ### 🖱️ Mouse Wheel -By using [`Mouse.wheel`](https://playwright.dev/java/docs/api/class-mouse#mouse-wheel) you are now able to scroll vertically or horizontally. +By using [`method: Mouse.wheel`] you are now able to scroll vertically or horizontally. ### 📜 New Headers API Previously it was not possible to get multiple header values of a response. This is now possible and additional helper functions are available: -- [Request.allHeaders()](https://playwright.dev/java/docs/api/class-request#request-all-headers) -- [Request.headersArray()](https://playwright.dev/java/docs/api/class-request#request-headers-array) -- [Request.headerValue(name: string)](https://playwright.dev/java/docs/api/class-request#request-header-value) -- [Response.allHeaders()](https://playwright.dev/java/docs/api/class-response#response-all-headers) -- [Response.headersArray()](https://playwright.dev/java/docs/api/class-response#response-headers-array) -- [Response.headerValue(name: string)](https://playwright.dev/java/docs/api/class-response#response-header-value) -- [Response.headerValues(name: string)](https://playwright.dev/java/docs/api/class-response#response-header-values) +- [`method: Request.allHeaders`] +- [`method: Request.headersArray`] +- [`method: Request.headerValue`] +- [`method: Response.allHeaders`] +- [`method: Response.headersArray`] +- [`method: Response.headerValue`] +- [`method: Response.headerValues`] ### 🌈 Forced-Colors emulation -Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [context options](https://playwright.dev/java/docs/api/class-browser#browser-new-context-option-color-scheme) or calling [Page.emulateMedia()](https://playwright.dev/java/docs/api/class-page#page-emulate-media). +Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [`method: Browser.newContext`] or calling [`method: Page.emulateMedia`]. ### New APIs -- [Page.route()](https://playwright.dev/java/docs/api/class-page#page-route) accepts new `times` option to specify how many times this route should be matched. -- [Page.setChecked(selector: string, checked: boolean)](https://playwright.dev/java/docs/api/class-page#page-set-checked) and [Locator.setChecked(selector: string, checked: boolean)](https://playwright.dev/java/docs/api/class-locator#locator-set-checked) was introduced to set the checked state of a checkbox. -- [Request.sizes()](https://playwright.dev/java/docs/api/class-request#request-sizes) Returns resource size information for given http request. -- [Tracing.startChunk()](https://playwright.dev/java/docs/api/class-tracing#tracing-start-chunk) - Start a new trace chunk. -- [Tracing.stopChunk()](https://playwright.dev/java/docs/api/class-tracing#tracing-stop-chunk) - Stops a new trace chunk. +- [`method: Page.route`] accepts new `times` option to specify how many times this route should be matched. +- [`method: Page.setChecked`] and [`method: Locator.setChecked`] were introduced to set the checked state of a checkbox. +- [`method: Request.sizes`] Returns resource size information for given http request. +- [`method: Tracing.startChunk`] - Start a new trace chunk. +- [`method: Tracing.stopChunk`] - Stops a new trace chunk. ### Browser Versions diff --git a/docs/src/release-notes-js.md b/docs/src/release-notes-js.md index 3320a0d14e..6440e91faa 100644 --- a/docs/src/release-notes-js.md +++ b/docs/src/release-notes-js.md @@ -1978,31 +1978,31 @@ This version of Playwright was also tested against the following stable channels #### 🖱️ Mouse Wheel -By using [`Page.mouse.wheel`](https://playwright.dev/docs/api/class-mouse#mouse-wheel) you are now able to scroll vertically or horizontally. +By using [`method: Mouse.wheel`] you are now able to scroll vertically or horizontally. #### 📜 New Headers API Previously it was not possible to get multiple header values of a response. This is now possible and additional helper functions are available: -- [Request.allHeaders()](https://playwright.dev/docs/api/class-request#request-all-headers) -- [Request.headersArray()](https://playwright.dev/docs/api/class-request#request-headers-array) -- [Request.headerValue(name: string)](https://playwright.dev/docs/api/class-request#request-header-value) -- [Response.allHeaders()](https://playwright.dev/docs/api/class-response#response-all-headers) -- [Response.headersArray()](https://playwright.dev/docs/api/class-response#response-headers-array) -- [Response.headerValue(name: string)](https://playwright.dev/docs/api/class-response#response-header-value) -- [Response.headerValues(name: string)](https://playwright.dev/docs/api/class-response#response-header-values) +- [`method: Request.allHeaders`] +- [`method: Request.headersArray`] +- [`method: Request.headerValue`] +- [`method: Response.allHeaders`] +- [`method: Response.headersArray`] +- [`method: Response.headerValue`] +- [`method: Response.headerValues`] #### 🌈 Forced-Colors emulation -Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [context options](https://playwright.dev/docs/api/class-browser#browser-new-context-option-forced-colors) or calling [Page.emulateMedia()](https://playwright.dev/docs/api/class-page#page-emulate-media). +Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [`method: Browser.newContext`] or calling [`method: Page.emulateMedia`]. #### New APIs -- [Page.route()](https://playwright.dev/docs/api/class-page#page-route) accepts new `times` option to specify how many times this route should be matched. -- [Page.setChecked(selector: string, checked: boolean)](https://playwright.dev/docs/api/class-page#page-set-checked) and [Locator.setChecked(selector: string, checked: boolean)](https://playwright.dev/docs/api/class-locator#locator-set-checked) was introduced to set the checked state of a checkbox. -- [Request.sizes()](https://playwright.dev/docs/api/class-request#request-sizes) Returns resource size information for given http request. -- [BrowserContext.tracing.startChunk()](https://playwright.dev/docs/api/class-tracing#tracing-start-chunk) - Start a new trace chunk. -- [BrowserContext.tracing.stopChunk()](https://playwright.dev/docs/api/class-tracing#tracing-stop-chunk) - Stops a new trace chunk. +- [`method: Page.route`] accepts new `times` option to specify how many times this route should be matched. +- [`method: Page.setChecked`] and [`method: Locator.setChecked`] were introduced to set the checked state of a checkbox. +- [`method: Request.sizes`] Returns resource size information for given http request. +- [`method: Tracing.startChunk`] - Start a new trace chunk. +- [`method: Tracing.stopChunk`] - Stops a new trace chunk. ### 🎭 Playwright Test @@ -2017,11 +2017,11 @@ test.describe.parallel('group', () => { }); ``` -By default, tests in a single file are run in order. If you have many independent tests in a single file, you can now run them in parallel with [test.describe.parallel(title, callback)](https://playwright.dev/docs/api/class-test#test-describe-parallel). +By default, tests in a single file are run in order. If you have many independent tests in a single file, you can now run them in parallel with [test.describe.parallel(title, callback)](./api/class-test#test-describe-parallel). #### 🛠 Add `--debug` CLI flag -By using `npx playwright test --debug` it will enable the [Playwright Inspector](https://playwright.dev/docs/debug#playwright-inspector) for you to debug your tests. +By using `npx playwright test --debug` it will enable the [Playwright Inspector](./debug#playwright-inspector) for you to debug your tests. ### Browser Versions diff --git a/docs/src/release-notes-python.md b/docs/src/release-notes-python.md index cc92290af1..2b01538f37 100644 --- a/docs/src/release-notes-python.md +++ b/docs/src/release-notes-python.md @@ -4,6 +4,43 @@ title: "Release notes" toc_max_heading_level: 2 --- +## Version 1.42 + +### New Locator Handler + +New method [`method: Page.addLocatorHandler`] registers a callback that will be invoked when specified element becomes visible and may block Playwright actions. The callback can get rid of the overlay. Here is an example that closes a cookie dialog when it appears. + +```python +# Setup the handler. +page.add_locator_handler( + page.get_by_role("heading", name="Hej! You are in control of your cookies."), + lambda: page.get_by_role("button", name="Accept all").click(), +) +# Write the test as usual. +page.goto("https://www.ikea.com/") +page.get_by_role("link", name="Collection of blue and white").click() +expect(page.get_by_role("heading", name="Light and easy")).to_be_visible() +``` + +### New APIs + +- [`method: Page.pdf`] accepts two new options [`option: tagged`] and [`option: outline`]. + +### Announcements + +* ⚠️ Ubuntu 18 is not supported anymore. + +### Browser Versions + +* Chromium 121.0.6167.57 +* Mozilla Firefox 121.0 +* WebKit 17.4 + +This version was also tested against the following stable channels: + +* Google Chrome 120 +* Microsoft Edge 120 + ## Version 1.41 ### New APIs @@ -1003,31 +1040,31 @@ This version of Playwright was also tested against the following stable channels ### 🖱️ Mouse Wheel -By using [`Page.mouse.wheel`](https://playwright.dev/python/docs/api/class-mouse#mouse-wheel) you are now able to scroll vertically or horizontally. +By using [`method: Mouse.wheel`] you are now able to scroll vertically or horizontally. ### 📜 New Headers API Previously it was not possible to get multiple header values of a response. This is now possible and additional helper functions are available: -- [Request.all_headers()](https://playwright.dev/python/docs/api/class-request#request-all-headers) -- [Request.headers_array()](https://playwright.dev/python/docs/api/class-request#request-headers-array) -- [Request.header_value(name: str)](https://playwright.dev/python/docs/api/class-request#request-header-value) -- [Response.all_headers()](https://playwright.dev/python/docs/api/class-response#response-all-headers) -- [Response.headers_array()](https://playwright.dev/python/docs/api/class-response#response-headers-array) -- [Response.header_value(name: str)](https://playwright.dev/python/docs/api/class-response#response-header-value) -- [Response.header_values(name: str)](https://playwright.dev/python/docs/api/class-response#response-header-values) +- [`method: Request.allHeaders`] +- [`method: Request.headersArray`] +- [`method: Request.headerValue`] +- [`method: Response.allHeaders`] +- [`method: Response.headersArray`] +- [`method: Response.headerValue`] +- [`method: Response.headerValues`] ### 🌈 Forced-Colors emulation -Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [context options](https://playwright.dev/python/docs/api/class-browser#browser-new-context-option-forced-colors) or calling [Page.emulate_media()](https://playwright.dev/python/docs/api/class-page#page-emulate-media). +Its now possible to emulate the `forced-colors` CSS media feature by passing it in the [`method: Browser.newContext`] or calling [`method: Page.emulateMedia`]. ### New APIs -- [Page.route()](https://playwright.dev/python/docs/api/class-page#page-route) accepts new `times` option to specify how many times this route should be matched. -- [Page.set_checked(selector: str, checked: bool)](https://playwright.dev/python/docs/api/class-page#page-set-checked) and [Locator.set_checked(selector: str, checked: bool)](https://playwright.dev/python/docs/api/class-locator#locator-set-checked) was introduced to set the checked state of a checkbox. -- [Request.sizes()](https://playwright.dev/python/docs/api/class-request#request-sizes) Returns resource size information for given http request. -- [BrowserContext.tracing.start_chunk()](https://playwright.dev/python/docs/api/class-tracing#tracing-start-chunk) - Start a new trace chunk. -- [BrowserContext.tracing.stop_chunk()](https://playwright.dev/python/docs/api/class-tracing#tracing-stop-chunk) - Stops a new trace chunk. +- [`method: Page.route`] accepts new `times` option to specify how many times this route should be matched. +- [`method: Page.setChecked`] and [`method: Locator.setChecked`] were introduced to set the checked state of a checkbox. +- [`method: Request.sizes`] Returns resource size information for given http request. +- [`method: Tracing.startChunk`] - Start a new trace chunk. +- [`method: Tracing.stopChunk`] - Stops a new trace chunk. ### Browser Versions diff --git a/docs/src/test-runners-python.md b/docs/src/test-runners-python.md index 402d33987f..0e3ffde0dd 100644 --- a/docs/src/test-runners-python.md +++ b/docs/src/test-runners-python.md @@ -53,14 +53,14 @@ def test_my_app_is_working(fixture_name): **Function scope**: These fixtures are created when requested in a test function and destroyed when the test ends. -- `context`: New [browser context](https://playwright.dev/python/docs/browser-contexts) for a test. -- `page`: New [browser page](https://playwright.dev/python/docs/pages) for a test. +- `context`: New [browser context](./browser-contexts) for a test. +- `page`: New [browser page](./pages) for a test. **Session scope**: These fixtures are created when requested in a test function and destroyed when all tests end. -- `playwright`: [Playwright](https://playwright.dev/python/docs/api/class-playwright) instance. -- `browser_type`: [BrowserType](https://playwright.dev/python/docs/api/class-browsertype) instance of the current browser. -- `browser`: [Browser](https://playwright.dev/python/docs/api/class-browser) instance launched by Playwright. +- `playwright`: [Playwright](./api/class-playwright) instance. +- `browser_type`: [BrowserType](./api/class-browsertype) instance of the current browser. +- `browser`: [Browser](./api/class-browser) instance launched by Playwright. - `browser_name`: Browser name as string. - `browser_channel`: Browser channel as string. - `is_chromium`, `is_webkit`, `is_firefox`: Booleans for the respective browser types.