diff --git a/docs/src/api/class-browsercontext.md b/docs/src/api/class-browsercontext.md index 3e7529c4828ef..0d97e060da539 100644 --- a/docs/src/api/class-browsercontext.md +++ b/docs/src/api/class-browsercontext.md @@ -1173,6 +1173,14 @@ Enabling routing disables http cache. ### param: BrowserContext.route.url * since: v1.8 +* langs: js +- `url` <[string]|[RegExp]|[URLPattern]|[function]\([URL]\):[boolean]> + +A glob pattern, regex pattern, URL pattern, or predicate that receives a [URL] to match during routing. If [`option: Browser.newContext.baseURL`] is set in the context options and the provided URL is a string that does not start with `*`, it is resolved using the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor. + +### param: BrowserContext.route.url +* since: v1.8 +* langs: python, csharp, java - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If [`option: Browser.newContext.baseURL`] is set in the context options and the provided URL is a string that does not start with `*`, it is resolved using the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor. @@ -1520,9 +1528,18 @@ routes for the [`param: url`]. ### param: BrowserContext.unroute.url * since: v1.8 +* langs: js +- `url` <[string]|[RegExp]|[URLPattern]|[function]\([URL]\):[boolean]> + +A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] used to register a routing with +[`method: BrowserContext.route`]. + +### param: BrowserContext.unroute.url +* since: v1.8 +* langs: python, csharp, java - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> -A glob pattern, regex pattern or predicate receiving [URL] used to register a routing with +A glob pattern, regex pattern, or predicate receiving [URL] used to register a routing with [`method: BrowserContext.route`]. ### param: BrowserContext.unroute.handler diff --git a/docs/src/api/class-frame.md b/docs/src/api/class-frame.md index f9c366e427413..531901bcbb8b7 100644 --- a/docs/src/api/class-frame.md +++ b/docs/src/api/class-frame.md @@ -2077,7 +2077,10 @@ a navigation. ### param: Frame.waitForNavigation.action = %%-csharp-wait-for-event-action-%% * since: v1.12 -### option: Frame.waitForNavigation.url = %%-wait-for-navigation-url-%% +### option: Frame.waitForNavigation.url = %%-js-wait-for-navigation-url-%% +* since: v1.8 + +### option: Frame.waitForNavigation.url = %%-python-csharp-java-wait-for-navigation-url-%% * since: v1.8 ### option: Frame.waitForNavigation.waitUntil = %%-navigation-wait-until-%% @@ -2273,7 +2276,10 @@ await frame.ClickAsync("a.delayed-navigation"); // clicking the link will indire await frame.WaitForURLAsync("**/target.html"); ``` -### param: Frame.waitForURL.url = %%-wait-for-navigation-url-%% +### param: Frame.waitForURL.url = %%-js-wait-for-navigation-url-%% +* since: v1.11 + +### param: Frame.waitForURL.url = %%-python-csharp-java-wait-for-navigation-url-%% * since: v1.11 ### option: Frame.waitForURL.timeout = %%-navigation-timeout-%% diff --git a/docs/src/api/class-page.md b/docs/src/api/class-page.md index 13299d4646cf7..5a08e5204bebc 100644 --- a/docs/src/api/class-page.md +++ b/docs/src/api/class-page.md @@ -2177,7 +2177,7 @@ var frame = page.FrameByUrl(".*domain.*"); * langs: js - `frameSelector` <[string]|[Object]> - `name` ?<[string]> Frame name specified in the `iframe`'s `name` attribute. Optional. - - `url` ?<[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern or predicate receiving + - `url` ?<[string]|[RegExp]|[URLPattern]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern, URL pattern, or predicate receiving frame's `url` as a [URL] object. Optional. Frame name or other frame lookup options. @@ -3691,6 +3691,14 @@ Enabling routing disables http cache. ### param: Page.route.url * since: v1.8 +* langs: js +- `url` <[string]|[RegExp]|[URLPattern]|[function]\([URL]\):[boolean]> + +A glob pattern, regex pattern, URL pattern, or predicate that receives a [URL] to match during routing. If [`option: Browser.newContext.baseURL`] is set in the context options and the provided URL is a string that does not start with `*`, it is resolved using the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor. + +### param: Page.route.url +* since: v1.8 +* langs: python, csharp, java - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> A glob pattern, regex pattern, or predicate that receives a [URL] to match during routing. If [`option: Browser.newContext.baseURL`] is set in the context options and the provided URL is a string that does not start with `*`, it is resolved using the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor. @@ -3823,6 +3831,14 @@ await page.RouteWebSocketAsync("/ws", ws => { ### param: Page.routeWebSocket.url * since: v1.48 +* langs: js +- `url` <[string]|[RegExp]|[URLPattern]|[function]\([URL]\):[boolean]> + +Only WebSockets with the url matching this pattern will be routed. A string pattern can be relative to the [`option: Browser.newContext.baseURL`] context option. + +### param: Page.routeWebSocket.url +* since: v1.48 +* langs: python, csharp, java - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> Only WebSockets with the url matching this pattern will be routed. A string pattern can be relative to the [`option: Browser.newContext.baseURL`] context option. @@ -4348,9 +4364,17 @@ the [`param: url`]. ### param: Page.unroute.url * since: v1.8 +* langs: js +- `url` <[string]|[RegExp]|[URLPattern]|[function]\([URL]\):[boolean]> + +A glob pattern, regex pattern, URL pattern, or predicate receiving [URL] to match while routing. + +### param: Page.unroute.url +* since: v1.8 +* langs: python, csharp, java - `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> -A glob pattern, regex pattern or predicate receiving [URL] to match while routing. +A glob pattern, regex pattern, or predicate receiving [URL] to match while routing. ### param: Page.unroute.handler * since: v1.8 @@ -4846,7 +4870,10 @@ a navigation. ### param: Page.waitForNavigation.action = %%-csharp-wait-for-event-action-%% * since: v1.12 -### option: Page.waitForNavigation.url = %%-wait-for-navigation-url-%% +### option: Page.waitForNavigation.url = %%-js-wait-for-navigation-url-%% +* since: v1.8 + +### option: Page.waitForNavigation.url = %%-python-csharp-java-wait-for-navigation-url-%% * since: v1.8 ### option: Page.waitForNavigation.waitUntil = %%-navigation-wait-until-%% @@ -5383,7 +5410,10 @@ await page.ClickAsync("a.delayed-navigation"); // clicking the link will indirec await page.WaitForURLAsync("**/target.html"); ``` -### param: Page.waitForURL.url = %%-wait-for-navigation-url-%% +### param: Page.waitForURL.url = %%-js-wait-for-navigation-url-%% +* since: v1.11 + +### param: Page.waitForURL.url = %%-python-csharp-java-wait-for-navigation-url-%% * since: v1.11 ### option: Page.waitForURL.timeout = %%-navigation-timeout-%% diff --git a/docs/src/api/class-pageassertions.md b/docs/src/api/class-pageassertions.md index 6420735f2be59..49e00880ee33e 100644 --- a/docs/src/api/class-pageassertions.md +++ b/docs/src/api/class-pageassertions.md @@ -302,6 +302,9 @@ await expect(page).toHaveURL('https://playwright.dev/docs/intro'); // Check for the page URL to contain 'doc', followed by an optional 's', followed by '/' await expect(page).toHaveURL(/docs?\//); +// Check for the page URL to match the URL pattern +await expect(page).toHaveURL(new URLPattern({ pathname: '/docs/*' })); + // Check for the predicate to be satisfied // For example: verify query strings await expect(page).toHaveURL(url => { @@ -337,7 +340,7 @@ await Expect(Page).ToHaveURLAsync(new Regex(".*checkout")); ### param: PageAssertions.toHaveURL.url * since: v1.18 * langs: js -- `url` <[string]|[RegExp]|[function]\([URL]\):[boolean]> +- `url` <[string]|[RegExp]|[URLPattern]|[function]\([URL]\):[boolean]> Expected URL string, RegExp, or predicate receiving [URL] to match. When [`option: Browser.newContext.baseURL`] is provided via the context options and the `url` argument is a string, the two values are merged via the [`new URL()`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL) constructor and used for the comparison against the current browser URL. diff --git a/docs/src/api/params.md b/docs/src/api/params.md index 90c3b9e3621f4..3441a7914d8ca 100644 --- a/docs/src/api/params.md +++ b/docs/src/api/params.md @@ -894,10 +894,19 @@ Options to select. If the `