diff --git a/README.md b/README.md index 59117f718..2e3f456f3 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H | | Linux | macOS | Windows | | :--- | :---: | :---: | :---: | -| Chromium 115.0.5790.24 | ✅ | ✅ | ✅ | -| WebKit 16.4 | ✅ | ✅ | ✅ | -| Firefox 113.0 | ✅ | ✅ | ✅ | +| Chromium 115.0.5790.75 | ✅ | ✅ | ✅ | +| WebKit 17.0 | ✅ | ✅ | ✅ | +| Firefox 115.0 | ✅ | ✅ | ✅ | ## Documentation diff --git a/playwright/_impl/_js_handle.py b/playwright/_impl/_js_handle.py index 51e1ee18a..b23b61ced 100644 --- a/playwright/_impl/_js_handle.py +++ b/playwright/_impl/_js_handle.py @@ -192,6 +192,9 @@ def parse_value(value: Any, refs: Optional[Dict[int, Any]] = None) -> Any: if "u" in value: return urlparse(value["u"]) + if "bi" in value: + return int(value["bi"]) + if "a" in value: a: List = [] refs[value["id"]] = a diff --git a/playwright/async_api/_generated.py b/playwright/async_api/_generated.py index 6b6c9ffbd..f73b91c31 100644 --- a/playwright/async_api/_generated.py +++ b/playwright/async_api/_generated.py @@ -896,7 +896,7 @@ async def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } await route.fallback(headers=headers) @@ -909,7 +909,7 @@ def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } route.fallback(headers=headers) @@ -958,7 +958,7 @@ async def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } await route.continue_(headers=headers) @@ -971,7 +971,7 @@ def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } route.continue_(headers=headers) @@ -1650,7 +1650,7 @@ async def get_properties(self) -> typing.Dict[str, "JSHandle"]: **Usage** ```py - handle = await page.evaluate_handle(\"({window, document})\") + handle = await page.evaluate_handle(\"({ window, document })\") properties = await handle.get_properties() window_handle = properties.get(\"window\") document_handle = properties.get(\"document\") @@ -1658,7 +1658,7 @@ async def get_properties(self) -> typing.Dict[str, "JSHandle"]: ``` ```py - handle = page.evaluate_handle(\"({window, document})\") + handle = page.evaluate_handle(\"({ window, document })\") properties = handle.get_properties() window_handle = properties.get(\"window\") document_handle = properties.get(\"document\") @@ -2896,13 +2896,13 @@ async def eval_on_selector( ```py tweet_handle = await page.query_selector(\".tweet\") assert await tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\" - assert await tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\" + assert await tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") == \"10\" ``` ```py tweet_handle = page.query_selector(\".tweet\") assert tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\" - assert tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\" + assert tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") == \"10\" ``` Parameters @@ -3124,11 +3124,11 @@ async def snapshot( ```py def find_focused_node(node): - if (node.get(\"focused\")) + if node.get(\"focused\"): return node for child in (node.get(\"children\") or []): found_node = find_focused_node(child) - if (found_node) + if found_node: return found_node return None @@ -3140,11 +3140,11 @@ def find_focused_node(node): ```py def find_focused_node(node): - if (node.get(\"focused\")) + if node.get(\"focused\"): return node for child in (node.get(\"children\") or []): found_node = find_focused_node(child) - if (found_node) + if found_node: return found_node return None @@ -7396,6 +7396,7 @@ def on( # or while waiting for an event. await page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ``` @@ -7406,6 +7407,7 @@ def on( # or while waiting for an event. page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ```""" @@ -7698,6 +7700,7 @@ def once( # or while waiting for an event. await page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ``` @@ -7708,6 +7711,7 @@ def once( # or while waiting for an event. page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ```""" @@ -9765,18 +9769,18 @@ async def route( ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() await page.route(\"/api/**\", handle_route) ``` ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() page.route(\"/api/**\", handle_route) ``` @@ -13502,18 +13506,18 @@ async def route( ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() await context.route(\"/api/**\", handle_route) ``` ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() context.route(\"/api/**\", handle_route) ``` @@ -15188,17 +15192,17 @@ async def stop(self) -> None: in REPL applications. ```py - >>> from playwright.sync_api import sync_playwright + from playwright.sync_api import sync_playwright - >>> playwright = sync_playwright().start() + playwright = sync_playwright().start() - >>> browser = playwright.chromium.launch() - >>> page = browser.new_page() - >>> page.goto(\"https://playwright.dev/\") - >>> page.screenshot(path=\"example.png\") - >>> browser.close() + browser = playwright.chromium.launch() + page = browser.new_page() + page.goto(\"https://playwright.dev/\") + page.screenshot(path=\"example.png\") + browser.close() - >>> playwright.stop() + playwright.stop() ``` """ @@ -16681,19 +16685,18 @@ def filter( ```py row_locator = page.locator(\"tr\") # ... - await row_locator - .filter(has_text=\"text in column 1\") - .filter(has=page.get_by_role(\"button\", name=\"column 2 button\")) - .screenshot() + await row_locator.filter(has_text=\"text in column 1\").filter( + has=page.get_by_role(\"button\", name=\"column 2 button\") + ).screenshot() + ``` ```py row_locator = page.locator(\"tr\") # ... - row_locator - .filter(has_text=\"text in column 1\") - .filter(has=page.get_by_role(\"button\", name=\"column 2 button\")) - .screenshot() + row_locator.filter(has_text=\"text in column 1\").filter( + has=page.get_by_role(\"button\", name=\"column 2 button\") + ).screenshot() ``` Parameters @@ -16744,7 +16747,7 @@ def or_(self, locator: "Locator") -> "Locator": new_email = page.get_by_role(\"button\", name=\"New\") dialog = page.get_by_text(\"Confirm security settings\") await expect(new_email.or_(dialog)).to_be_visible() - if (await dialog.is_visible()) + if (await dialog.is_visible()): await page.get_by_role(\"button\", name=\"Dismiss\").click() await new_email.click() ``` @@ -16753,7 +16756,7 @@ def or_(self, locator: "Locator") -> "Locator": new_email = page.get_by_role(\"button\", name=\"New\") dialog = page.get_by_text(\"Confirm security settings\") expect(new_email.or_(dialog)).to_be_visible() - if (dialog.is_visible()) + if (dialog.is_visible()): page.get_by_role(\"button\", name=\"Dismiss\").click() new_email.click() ``` diff --git a/playwright/sync_api/_generated.py b/playwright/sync_api/_generated.py index 32d1e99e0..f1b41ca37 100644 --- a/playwright/sync_api/_generated.py +++ b/playwright/sync_api/_generated.py @@ -908,7 +908,7 @@ async def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } await route.fallback(headers=headers) @@ -921,7 +921,7 @@ def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } route.fallback(headers=headers) @@ -972,7 +972,7 @@ async def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } await route.continue_(headers=headers) @@ -985,7 +985,7 @@ def handle(route, request): # override headers headers = { **request.headers, - \"foo\": \"foo-value\" # set \"foo\" header + \"foo\": \"foo-value\", # set \"foo\" header \"bar\": None # remove \"bar\" header } route.continue_(headers=headers) @@ -1654,7 +1654,7 @@ def get_properties(self) -> typing.Dict[str, "JSHandle"]: **Usage** ```py - handle = await page.evaluate_handle(\"({window, document})\") + handle = await page.evaluate_handle(\"({ window, document })\") properties = await handle.get_properties() window_handle = properties.get(\"window\") document_handle = properties.get(\"document\") @@ -1662,7 +1662,7 @@ def get_properties(self) -> typing.Dict[str, "JSHandle"]: ``` ```py - handle = page.evaluate_handle(\"({window, document})\") + handle = page.evaluate_handle(\"({ window, document })\") properties = handle.get_properties() window_handle = properties.get(\"window\") document_handle = properties.get(\"document\") @@ -2932,13 +2932,13 @@ def eval_on_selector( ```py tweet_handle = await page.query_selector(\".tweet\") assert await tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\" - assert await tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\" + assert await tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") == \"10\" ``` ```py tweet_handle = page.query_selector(\".tweet\") assert tweet_handle.eval_on_selector(\".like\", \"node => node.innerText\") == \"100\" - assert tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") = \"10\" + assert tweet_handle.eval_on_selector(\".retweets\", \"node => node.innerText\") == \"10\" ``` Parameters @@ -3168,11 +3168,11 @@ def snapshot( ```py def find_focused_node(node): - if (node.get(\"focused\")) + if node.get(\"focused\"): return node for child in (node.get(\"children\") or []): found_node = find_focused_node(child) - if (found_node) + if found_node: return found_node return None @@ -3184,11 +3184,11 @@ def find_focused_node(node): ```py def find_focused_node(node): - if (node.get(\"focused\")) + if node.get(\"focused\"): return node for child in (node.get(\"children\") or []): found_node = find_focused_node(child) - if (found_node) + if found_node: return found_node return None @@ -7504,6 +7504,7 @@ def on(self, event: Literal["crash"], f: typing.Callable[["Page"], "None"]) -> N # or while waiting for an event. await page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ``` @@ -7514,6 +7515,7 @@ def on(self, event: Literal["crash"], f: typing.Callable[["Page"], "None"]) -> N # or while waiting for an event. page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ```""" @@ -7756,6 +7758,7 @@ def once( # or while waiting for an event. await page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ``` @@ -7766,6 +7769,7 @@ def once( # or while waiting for an event. page.wait_for_event(\"popup\") except Error as e: + pass # when the page crashes, exception message contains \"crash\". ```""" @@ -9827,18 +9831,18 @@ def route( ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() await page.route(\"/api/**\", handle_route) ``` ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() page.route(\"/api/**\", handle_route) ``` @@ -13558,18 +13562,18 @@ def route( ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() await context.route(\"/api/**\", handle_route) ``` ```py def handle_route(route): - if (\"my-string\" in route.request.post_data) + if (\"my-string\" in route.request.post_data): route.fulfill(body=\"mocked-data\") - else + else: route.continue_() context.route(\"/api/**\", handle_route) ``` @@ -15264,17 +15268,17 @@ def stop(self) -> None: in REPL applications. ```py - >>> from playwright.sync_api import sync_playwright + from playwright.sync_api import sync_playwright - >>> playwright = sync_playwright().start() + playwright = sync_playwright().start() - >>> browser = playwright.chromium.launch() - >>> page = browser.new_page() - >>> page.goto(\"https://playwright.dev/\") - >>> page.screenshot(path=\"example.png\") - >>> browser.close() + browser = playwright.chromium.launch() + page = browser.new_page() + page.goto(\"https://playwright.dev/\") + page.screenshot(path=\"example.png\") + browser.close() - >>> playwright.stop() + playwright.stop() ``` """ @@ -16779,19 +16783,18 @@ def filter( ```py row_locator = page.locator(\"tr\") # ... - await row_locator - .filter(has_text=\"text in column 1\") - .filter(has=page.get_by_role(\"button\", name=\"column 2 button\")) - .screenshot() + await row_locator.filter(has_text=\"text in column 1\").filter( + has=page.get_by_role(\"button\", name=\"column 2 button\") + ).screenshot() + ``` ```py row_locator = page.locator(\"tr\") # ... - row_locator - .filter(has_text=\"text in column 1\") - .filter(has=page.get_by_role(\"button\", name=\"column 2 button\")) - .screenshot() + row_locator.filter(has_text=\"text in column 1\").filter( + has=page.get_by_role(\"button\", name=\"column 2 button\") + ).screenshot() ``` Parameters @@ -16842,7 +16845,7 @@ def or_(self, locator: "Locator") -> "Locator": new_email = page.get_by_role(\"button\", name=\"New\") dialog = page.get_by_text(\"Confirm security settings\") await expect(new_email.or_(dialog)).to_be_visible() - if (await dialog.is_visible()) + if (await dialog.is_visible()): await page.get_by_role(\"button\", name=\"Dismiss\").click() await new_email.click() ``` @@ -16851,7 +16854,7 @@ def or_(self, locator: "Locator") -> "Locator": new_email = page.get_by_role(\"button\", name=\"New\") dialog = page.get_by_text(\"Confirm security settings\") expect(new_email.or_(dialog)).to_be_visible() - if (dialog.is_visible()) + if (dialog.is_visible()): page.get_by_role(\"button\", name=\"Dismiss\").click() new_email.click() ``` diff --git a/setup.py b/setup.py index 02f705604..79ab19e30 100644 --- a/setup.py +++ b/setup.py @@ -30,7 +30,7 @@ InWheel = None from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand -driver_version = "1.35.0" +driver_version = "1.36.0" def extractall(zip: zipfile.ZipFile, path: str) -> None: diff --git a/tests/async/test_evaluate.py b/tests/async/test_evaluate.py index 6ef57cc71..95c528d33 100644 --- a/tests/async/test_evaluate.py +++ b/tests/async/test_evaluate.py @@ -16,7 +16,7 @@ from datetime import datetime from urllib.parse import ParseResult, urlparse -from playwright.async_api import Error +from playwright.async_api import Error, Page async def test_evaluate_work(page): @@ -64,6 +64,11 @@ async def test_evaluate_transfer_arrays(page): assert result == [1, 2, 3] +async def test_evaluate_transfer_bigint(page: Page) -> None: + assert await page.evaluate("() => 42n") == 42 + assert await page.evaluate("a => a", 17) == 17 + + async def test_evaluate_return_undefined_for_objects_with_symbols(page): assert await page.evaluate('[Symbol("foo4")]') == [None] assert (