add feedback

This commit is contained in:
Max Schmitt 2024-09-23 14:25:38 +02:00
parent 7039184021
commit b1c12a3b14

View file

@ -702,25 +702,24 @@ await Page.RouteAsync("**/title.html", async route =>
## Glob URL patterns ## Glob URL patterns
Playwright uses glob patterns for URL matching in network interception methods like [`method: Page.route`] or [`method: Page.waitForResponse`]. These glob patterns are more limited than typical file globs: Playwright uses simplified glob patterns for URL matching in network interception methods like [`method: Page.route`] or [`method: Page.waitForResponse`]. These patterns support basic wildcards:
1. Asterisks: 1. Asterisks:
- A single `*` matches any characters except `/` - A single `*` matches any characters except `/`
- A double `**` matches any characters including `/` - A double `**` matches any characters including `/`
1. Question mark `?` matches any single character except `/` 1. Question mark `?` matches any single character except `/`
1. Character sets `[]` work like [RegExp character sets](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions/Character_classes#types): 1. Curly braces `{}` can be used to match a list of options separated by commas `,`
- `[abc]` matches any single character from the set (a, b, or c)
- `[a-z]` matches any single character in the range a to z
1. Alternatives `{}` work like a logical OR:
- `{png,jpg,jpeg}` matches "png" OR "jpg" OR "jpeg"
Examples: Examples:
- `https://example.com/*.js` would match `https://example.com/file.js` but not `https://example.com/bar/file.js` - `https://example.com/*.js` matches `https://example.com/file.js` but not `https://example.com/path/file.js`
- `**/*.js` would match all of the above - `**/*.js` matches both `https://example.com/file.js` and `https://example.com/path/file.js`
- `https://*.com/*.js` would match `https://example.com/file.js` but not `https://example.com/path/file.js` - `**/*.{png,jpg,jpeg}` matches all image requests
- `https://**/*.js` would match both `https://example.com/file.js` and `https://example.com/path/file.js`
It's important to note that the glob pattern needs to match the entire URL, not just a part of it. When using globs for URL matching, consider the full URL structure, including the protocol and path separators. Important notes:
- The glob pattern must match the entire URL, not just a part of it.
- When using globs for URL matching, consider the full URL structure, including the protocol and path separators.
- For more complex matching requirements, consider using [RegExp] instead of glob patterns.
## WebSockets ## WebSockets