Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 🎭 [Playwright](https://github.com/microsoft/playwright) for Python

[![PyPI version](https://badge.fury.io/py/playwright.svg)](https://pypi.python.org/pypi/playwright/) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-86.0.4217.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-78.0b5-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [![WebKit version](https://img.shields.io/badge/webkit-14.0-blue.svg?logo=safari)](https://webkit.org/)
[![PyPI version](https://badge.fury.io/py/playwright.svg)](https://pypi.python.org/pypi/playwright/) [![Join Slack](https://img.shields.io/badge/join-slack-infomational)](https://join.slack.com/t/playwright/shared_invite/enQtOTEyMTUxMzgxMjIwLThjMDUxZmIyNTRiMTJjNjIyMzdmZDA3MTQxZWUwZTFjZjQwNGYxZGM5MzRmNzZlMWI5ZWUyOTkzMjE5Njg1NDg) <!-- GEN:chromium-version-badge -->[![Chromium version](https://img.shields.io/badge/chromium-86.0.4217.0-blue.svg?logo=google-chrome)](https://www.chromium.org/Home)<!-- GEN:stop --> <!-- GEN:firefox-version-badge -->[![Firefox version](https://img.shields.io/badge/firefox-79.0a1-blue.svg?logo=mozilla-firefox)](https://www.mozilla.org/en-US/firefox/new/)<!-- GEN:stop --> [![WebKit version](https://img.shields.io/badge/webkit-14.0-blue.svg?logo=safari)](https://webkit.org/)

##### [Docs](#documentation) | [API reference](https://github.com/microsoft/playwright/blob/master/docs/api.md)

Expand All @@ -10,7 +10,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->86.0.4217.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit 14.0 | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->78.0b5<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->79.0a1<!-- GEN:stop --> | ✅ | ✅ | ✅ |

Headless execution is supported for all the browsers on all platforms.

Expand Down
80 changes: 40 additions & 40 deletions api.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion driver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
},
"license": "Apache-2.0",
"dependencies": {
"playwright": "1.3.0-next.1596659749397"
"playwright": "1.3.0-next.1596843106133"
},
"devDependencies": {
"pkg": "^4.4.9"
Expand Down
32 changes: 16 additions & 16 deletions playwright/async_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ async def hover(
) -> NoneType:
"""ElementHandle.hover

This method scrolls element into view if needed, and then uses page.mouse to hover over the center of the element.
This method waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to hover over the center of the element.
If the element is detached from DOM, the method throws an error.

Parameters
Expand Down Expand Up @@ -979,7 +979,7 @@ async def click(
) -> NoneType:
"""ElementHandle.click

This method scrolls element into view if needed, and then uses page.mouse to click in the center of the element.
This method waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to click in the center of the element.
If the element is detached from DOM, the method throws an error.

Parameters
Expand Down Expand Up @@ -1028,7 +1028,7 @@ async def dblclick(
) -> NoneType:
"""ElementHandle.dblclick

This method scrolls element into view if needed, and then uses page.mouse to click in the center of the element.
This method waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to double click in the center of the element.
If the element is detached from DOM, the method throws an error.
Bear in mind that if the first click of the `dblclick()` triggers a navigation event, there will be an exception.

Expand Down Expand Up @@ -1241,7 +1241,7 @@ async def check(
) -> NoneType:
"""ElementHandle.check

If element is not already checked, it scrolls it into view if needed, and then uses elementHandle.click to click in the center of the element.
This method waits for actionability checks. Then, if the element is not already checked, this method scrolls the element into view and uses elementHandle.click to click in the center of the element.

Parameters
----------
Expand All @@ -1263,7 +1263,7 @@ async def uncheck(
) -> NoneType:
"""ElementHandle.uncheck

If element is not already unchecked, it scrolls it into view if needed, and then uses elementHandle.click to click in the center of the element.
This method waits for actionability checks. Then, if the element is not already unchecked, this method scrolls the element into view and uses elementHandle.click to click in the center of the element.

Parameters
----------
Expand Down Expand Up @@ -2108,7 +2108,7 @@ async def click(
) -> NoneType:
"""Frame.click

This method fetches an element with `selector`, scrolls it into view if needed, and then uses page.mouse to click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.

Parameters
Expand Down Expand Up @@ -2160,7 +2160,7 @@ async def dblclick(
) -> NoneType:
"""Frame.dblclick

This method fetches an element with `selector`, scrolls it into view if needed, and then uses page.mouse to double click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to double click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.
Bear in mind that if the first click of the `dblclick()` triggers a navigation event, there will be an exception.

Expand Down Expand Up @@ -2339,7 +2339,7 @@ async def hover(
) -> NoneType:
"""Frame.hover

This method fetches an element with `selector`, scrolls it into view if needed, and then uses page.mouse to hover over the center of the element.
This method waits for an element matching `selector`, waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to hover over the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.

Parameters
Expand Down Expand Up @@ -2529,7 +2529,7 @@ async def check(
) -> NoneType:
"""Frame.check

This method fetches an element with `selector`, if element is not already checked, it scrolls it into view if needed, and then uses frame.click to click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks. Then, if the element is not already checked, this method scrolls the element into view and uses elementHandle.click to click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.

Parameters
Expand Down Expand Up @@ -2558,7 +2558,7 @@ async def uncheck(
) -> NoneType:
"""Frame.uncheck

This method fetches an element with `selector`, if element is not already unchecked, it scrolls it into view if needed, and then uses frame.click to click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks. Then, if the element is not already unchecked, this method scrolls the element into view and uses elementHandle.click to click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.

Parameters
Expand Down Expand Up @@ -4068,7 +4068,7 @@ async def click(
) -> NoneType:
"""Page.click

This method fetches an element with `selector`, scrolls it into view if needed, and then uses page.mouse to click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.
Shortcut for page.mainFrame().click(selector[, options]).

Expand Down Expand Up @@ -4121,7 +4121,7 @@ async def dblclick(
) -> NoneType:
"""Page.dblclick

This method fetches an element with `selector`, scrolls it into view if needed, and then uses page.mouse to double click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to double click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.
Bear in mind that if the first click of the `dblclick()` triggers a navigation event, there will be an exception.

Expand Down Expand Up @@ -4304,7 +4304,7 @@ async def hover(
) -> NoneType:
"""Page.hover

This method fetches an element with `selector`, scrolls it into view if needed, and then uses page.mouse to hover over the center of the element.
This method waits for an element matching `selector`, waits for actionability checks, then scrolls the element into view if needed and uses page.mouse to hover over the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.
Shortcut for page.mainFrame().hover(selector[, options]).

Expand Down Expand Up @@ -4494,7 +4494,7 @@ async def check(
) -> NoneType:
"""Page.check

This method fetches an element with `selector`, if element is not already checked, it scrolls it into view if needed, and then uses page.click to click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks. Then, if the element is not already checked, this method scrolls the element into view and uses elementHandle.click to click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.
Shortcut for page.mainFrame().check(selector[, options]).

Expand Down Expand Up @@ -4524,7 +4524,7 @@ async def uncheck(
) -> NoneType:
"""Page.uncheck

This method fetches an element with `selector`, if element is not already unchecked, it scrolls it into view if needed, and then uses page.click to click in the center of the element.
This method waits for an element matching `selector`, waits for actionability checks. Then, if the element is not already unchecked, this method scrolls the element into view and uses elementHandle.click to click in the center of the element.
If there's no element matching `selector`, the method waits until a matching element appears in the DOM. If the element is detached during the actionability checks, the action is retried.
Shortcut for page.mainFrame().uncheck(selector[, options]).

Expand Down Expand Up @@ -4574,7 +4574,7 @@ async def waitForFunction(
The `waitForFunction` can be used to observe viewport size change:

To pass an argument from Node.js to the predicate of `page.waitForFunction` function:
Shortcut for [page.mainFrame().waitForFunction(pageFunction, arg, options]])](#framewaitforfunctionpagefunction-arg-options).
Shortcut for page.mainFrame().waitForFunction(pageFunction[, arg, options]).

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion playwright/drivers/browsers.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
{
"name": "firefox",
"revision": "1144",
"revision": "1154",
"download": true
},
{
Expand Down
14 changes: 11 additions & 3 deletions playwright/page.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,15 @@ async def screenshot(
fullPage: bool = None,
clip: FloatRect = None,
) -> bytes:
binary = await self._channel.send("screenshot", locals_to_params(locals()))
return base64.b64decode(binary)
params = locals_to_params(locals())
if "path" in params:
del params["path"]
encoded_binary = await self._channel.send("screenshot", params)
decoded_binary = base64.b64decode(encoded_binary)
if path:
with open(path, "wb") as fd:
fd.write(decoded_binary)
return decoded_binary

async def title(self) -> str:
return await self._main_frame.title()
Expand Down Expand Up @@ -722,7 +729,8 @@ async def pdf(
path: str = None,
) -> bytes:
params = locals_to_params(locals())
del params["path"]
if "path" in params:
del params["path"]
encoded_binary = await self._channel.send("pdf", params)
decoded_binary = base64.b64decode(encoded_binary)
if path:
Expand Down
Loading