Skip to content

Commit d9f4c0c

Browse files
committed
chore: roll to 1.55.0-alpha-1755516433000
1 parent 254aabd commit d9f4c0c

File tree

12 files changed

+100
-106
lines changed

12 files changed

+100
-106
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
44

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->139.0.7258.5<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->140.0.7339.16<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->26.0<!-- GEN:stop --> ||||
9-
| Firefox <!-- GEN:firefox-version -->140.0.2<!-- GEN:stop --> ||||
9+
| Firefox <!-- GEN:firefox-version -->141.0<!-- GEN:stop --> ||||
1010

1111
## Documentation
1212

playwright/_impl/_helper.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
Optional,
3030
Pattern,
3131
Set,
32+
Tuple,
3233
TypedDict,
3334
TypeVar,
3435
Union,
@@ -221,14 +222,35 @@ def map_token(original: str, replacement: str) -> str:
221222
processed_parts.append(new_prefix + new_suffix)
222223

223224
relative_path = "/".join(processed_parts)
224-
resolved_url = urljoin(base_url if base_url is not None else "", relative_path)
225+
resolved_url, case_insensitive_part = resolve_base_url(base_url, relative_path)
225226

226227
for replacement, original in token_map.items():
227-
resolved_url = resolved_url.replace(replacement, original, 1)
228+
normalize = case_insensitive_part and replacement in case_insensitive_part
229+
resolved_url = resolved_url.replace(
230+
replacement, original.lower() if normalize else original, 1
231+
)
228232

229233
return ensure_trailing_slash(resolved_url)
230234

231235

236+
def resolve_base_url(
237+
base_url: Optional[str], given_url: str
238+
) -> Tuple[str, Optional[str]]:
239+
try:
240+
resolved = urljoin(base_url if base_url is not None else "", given_url)
241+
parsed = urlparse(resolved)
242+
# Schema and domain are case-insensitive.
243+
hostname_port = (
244+
parsed.hostname or ""
245+
) # can't use parsed.netloc because it includes userinfo (username:password)
246+
if parsed.port:
247+
hostname_port += f":{parsed.port}"
248+
case_insensitive_prefix = f"{parsed.scheme}://{hostname_port}"
249+
return resolved, case_insensitive_prefix
250+
except Exception:
251+
return given_url, None
252+
253+
232254
# In Node.js, new URL('http://localhost') returns 'http://localhost/'.
233255
# To ensure the same url matching behavior, do the same.
234256
def ensure_trailing_slash(url: str) -> str:

playwright/async_api/_generated.py

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11487,8 +11487,8 @@ async def main():
1148711487
async def pause(self) -> None:
1148811488
"""Page.pause
1148911489

11490-
Pauses script execution. Playwright will stop executing the script and wait for the user to either press 'Resume'
11491-
button in the page overlay or to call `playwright.resume()` in the DevTools console.
11490+
Pauses script execution. Playwright will stop executing the script and wait for the user to either press the
11491+
'Resume' button in the page overlay or to call `playwright.resume()` in the DevTools console.
1149211492

1149311493
User can inspect selectors or perform manual steps while paused. Resume will continue running the original script
1149411494
from the place it was paused.
@@ -13921,6 +13921,10 @@ async def new_context(
1392113921
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1392213922
with an exact match to the request origin that the certificate is valid for.
1392313923

13924+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
13925+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
13926+
does not match any of the domains you plan to visit.
13927+
1392413928
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1392513929
work by replacing `localhost` with `local.playwright`.
1392613930

@@ -14152,6 +14156,10 @@ async def new_page(
1415214156
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1415314157
with an exact match to the request origin that the certificate is valid for.
1415414158

14159+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
14160+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
14161+
does not match any of the domains you plan to visit.
14162+
1415514163
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1415614164
work by replacing `localhost` with `local.playwright`.
1415714165

@@ -14559,6 +14567,13 @@ async def launch_persistent_context(
1455914567
**parent** directory of the "Profile Path" seen at `chrome://version`.
1456014568

1456114569
Note that browsers do not allow launching multiple instances with the same User Data Directory.
14570+
14571+
**NOTE** Chromium/Chrome: Due to recent Chrome policy changes, automating the default Chrome user profile is not
14572+
supported. Pointing `userDataDir` to Chrome's main "User Data" directory (the profile used for your regular
14573+
browsing) may result in pages not loading or the browser exiting. Create and use a separate directory (for example,
14574+
an empty folder) as your automation profile instead. See https://developer.chrome.com/blog/remote-debugging-port
14575+
for details.
14576+
1456214577
channel : Union[str, None]
1456314578
Browser distribution channel.
1456414579

@@ -14733,6 +14748,10 @@ async def launch_persistent_context(
1473314748
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1473414749
with an exact match to the request origin that the certificate is valid for.
1473514750

14751+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
14752+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
14753+
does not match any of the domains you plan to visit.
14754+
1473614755
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1473714756
work by replacing `localhost` with `local.playwright`.
1473814757

@@ -18801,6 +18820,10 @@ async def new_context(
1880118820
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1880218821
with an exact match to the request origin that the certificate is valid for.
1880318822

18823+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
18824+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
18825+
does not match any of the domains you plan to visit.
18826+
1880418827
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1880518828
work by replacing `localhost` with `local.playwright`.
1880618829

playwright/sync_api/_generated.py

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11569,8 +11569,8 @@ def run(playwright: Playwright):
1156911569
def pause(self) -> None:
1157011570
"""Page.pause
1157111571

11572-
Pauses script execution. Playwright will stop executing the script and wait for the user to either press 'Resume'
11573-
button in the page overlay or to call `playwright.resume()` in the DevTools console.
11572+
Pauses script execution. Playwright will stop executing the script and wait for the user to either press the
11573+
'Resume' button in the page overlay or to call `playwright.resume()` in the DevTools console.
1157411574

1157511575
User can inspect selectors or perform manual steps while paused. Resume will continue running the original script
1157611576
from the place it was paused.
@@ -12255,7 +12255,7 @@ def add_locator_handler(
1225512255

1225612256
```py
1225712257
# Setup the handler.
12258-
def handler():
12258+
async def handler():
1225912259
await page.get_by_role(\"button\", name=\"No thanks\").click()
1226012260
await page.add_locator_handler(page.get_by_text(\"Sign up to the newsletter\"), handler)
1226112261

@@ -12268,7 +12268,7 @@ def handler():
1226812268

1226912269
```py
1227012270
# Setup the handler.
12271-
def handler():
12271+
async def handler():
1227212272
await page.get_by_role(\"button\", name=\"Remind me later\").click()
1227312273
await page.add_locator_handler(page.get_by_text(\"Confirm your security details\"), handler)
1227412274

@@ -12283,7 +12283,7 @@ def handler():
1228312283

1228412284
```py
1228512285
# Setup the handler.
12286-
def handler():
12286+
async def handler():
1228712287
await page.evaluate(\"window.removeObstructionsForTestIfNeeded()\")
1228812288
await page.add_locator_handler(page.locator(\"body\"), handler, no_wait_after=True)
1228912289

@@ -12296,7 +12296,7 @@ def handler():
1229612296
invocations by setting `times`:
1229712297

1229812298
```py
12299-
def handler(locator):
12299+
async def handler(locator):
1230012300
await locator.click()
1230112301
await page.add_locator_handler(page.get_by_label(\"Close\"), handler, times=1)
1230212302
```
@@ -13952,6 +13952,10 @@ def new_context(
1395213952
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1395313953
with an exact match to the request origin that the certificate is valid for.
1395413954

13955+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
13956+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
13957+
does not match any of the domains you plan to visit.
13958+
1395513959
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1395613960
work by replacing `localhost` with `local.playwright`.
1395713961

@@ -14185,6 +14189,10 @@ def new_page(
1418514189
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1418614190
with an exact match to the request origin that the certificate is valid for.
1418714191

14192+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
14193+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
14194+
does not match any of the domains you plan to visit.
14195+
1418814196
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1418914197
work by replacing `localhost` with `local.playwright`.
1419014198

@@ -14598,6 +14606,13 @@ def launch_persistent_context(
1459814606
**parent** directory of the "Profile Path" seen at `chrome://version`.
1459914607

1460014608
Note that browsers do not allow launching multiple instances with the same User Data Directory.
14609+
14610+
**NOTE** Chromium/Chrome: Due to recent Chrome policy changes, automating the default Chrome user profile is not
14611+
supported. Pointing `userDataDir` to Chrome's main "User Data" directory (the profile used for your regular
14612+
browsing) may result in pages not loading or the browser exiting. Create and use a separate directory (for example,
14613+
an empty folder) as your automation profile instead. See https://developer.chrome.com/blog/remote-debugging-port
14614+
for details.
14615+
1460114616
channel : Union[str, None]
1460214617
Browser distribution channel.
1460314618

@@ -14772,6 +14787,10 @@ def launch_persistent_context(
1477214787
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1477314788
with an exact match to the request origin that the certificate is valid for.
1477414789

14790+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
14791+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
14792+
does not match any of the domains you plan to visit.
14793+
1477514794
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1477614795
work by replacing `localhost` with `local.playwright`.
1477714796

@@ -18922,6 +18941,10 @@ def new_context(
1892218941
`passphrase` property should be provided if the certificate is encrypted. The `origin` property should be provided
1892318942
with an exact match to the request origin that the certificate is valid for.
1892418943

18944+
Client certificate authentication is only active when at least one client certificate is provided. If you want to
18945+
reject all client certificates sent by the server, you need to provide a client certificate with an `origin` that
18946+
does not match any of the domains you plan to visit.
18947+
1892518948
**NOTE** When using WebKit on macOS, accessing `localhost` will not pick up client certificates. You can make it
1892618949
work by replacing `localhost` with `local.playwright`.
1892718950

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
import zipfile
2222
from typing import Dict
2323

24-
driver_version = "1.54.1"
24+
driver_version = "1.55.0-alpha-1755516433000"
2525

2626
base_wheel_bundles = [
2727
{

tests/assets/simple-extension/content-script.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/assets/simple-extension/index.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/assets/simple-extension/manifest.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/async/test_launcher.py

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import asyncio
1616
import os
1717
from pathlib import Path
18-
from typing import Dict, Optional
18+
from typing import Dict
1919

2020
import pytest
2121

@@ -107,39 +107,3 @@ async def test_browser_close_should_be_callable_twice(
107107
browser.close(),
108108
)
109109
await browser.close()
110-
111-
112-
@pytest.mark.only_browser("chromium")
113-
async def test_browser_launch_should_return_background_pages(
114-
browser_type: BrowserType,
115-
tmp_path: Path,
116-
browser_channel: Optional[str],
117-
assetdir: Path,
118-
launch_arguments: Dict,
119-
) -> None:
120-
if browser_channel:
121-
pytest.skip()
122-
123-
extension_path = str(assetdir / "simple-extension")
124-
context = await browser_type.launch_persistent_context(
125-
str(tmp_path),
126-
**{
127-
**launch_arguments,
128-
"headless": False,
129-
"args": [
130-
f"--disable-extensions-except={extension_path}",
131-
f"--load-extension={extension_path}",
132-
],
133-
},
134-
)
135-
background_page = None
136-
if len(context.background_pages):
137-
background_page = context.background_pages[0]
138-
else:
139-
background_page = await context.wait_for_event("backgroundpage")
140-
assert background_page
141-
assert background_page in context.background_pages
142-
assert background_page not in context.pages
143-
await context.close()
144-
assert len(context.background_pages) == 0
145-
assert len(context.pages) == 0

tests/async/test_page_route.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,6 +1128,23 @@ def glob_to_regex(pattern: str) -> re.Pattern:
11281128
"http://playwright.dev/foo/", "http://playwright.dev/foo/bar?x=y", "./bar?x=y"
11291129
)
11301130

1131+
# Case insensitive matching
1132+
assert url_matches(
1133+
None, "https://playwright.dev/fooBAR", "HtTpS://pLaYwRiGhT.dEv/fooBAR"
1134+
)
1135+
assert url_matches(
1136+
"http://ignored",
1137+
"https://playwright.dev/fooBAR",
1138+
"HtTpS://pLaYwRiGhT.dEv/fooBAR",
1139+
)
1140+
# Path and search query are case-sensitive
1141+
assert not url_matches(
1142+
None, "https://playwright.dev/foobar", "https://playwright.dev/fooBAR"
1143+
)
1144+
assert not url_matches(
1145+
None, "https://playwright.dev/foobar?a=b", "https://playwright.dev/foobar?A=B"
1146+
)
1147+
11311148
# This is not supported, we treat ? as a query separator.
11321149
assert not url_matches(
11331150
None,

0 commit comments

Comments
 (0)