Skip to content

Commit

Permalink
chore(roll): roll Playwright to v1.36.0 (#2012)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jul 13, 2023
1 parent 52e66de commit 42a3db2
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 81 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->115.0.5790.24<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->16.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->113.0<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->115.0.5790.75<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->17.0<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->115.0<!-- GEN:stop --> ||||

## Documentation

Expand Down
3 changes: 3 additions & 0 deletions playwright/_impl/_js_handle.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
79 changes: 41 additions & 38 deletions playwright/async_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -1650,15 +1650,15 @@ 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\")
await handle.dispose()
```

```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\")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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\".
```

Expand All @@ -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\".
```"""

Expand Down Expand Up @@ -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\".
```

Expand All @@ -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\".
```"""

Expand Down Expand Up @@ -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)
```
Expand Down Expand Up @@ -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)
```
Expand Down Expand Up @@ -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()
```
"""

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
```
Expand All @@ -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()
```
Expand Down
Loading

0 comments on commit 42a3db2

Please sign in to comment.