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
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 -->93.0.4543.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Chromium <!-- GEN:chromium-version -->93.0.4576.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| WebKit <!-- GEN:webkit-version -->14.2<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->89.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |
| Firefox <!-- GEN:firefox-version -->90.0<!-- GEN:stop --> | ✅ | ✅ | ✅ |

## Documentation

Expand Down
4 changes: 2 additions & 2 deletions playwright/_impl/_browser_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ async def launch(
try:
return from_channel(await self._channel.send("launch", params))
except Exception as e:
if "because executable doesn't exist" in str(e):
if "npx playwright install" in str(e):
raise not_installed_error(f'"{self.name}" browser was not found.')
raise e

Expand Down Expand Up @@ -145,7 +145,7 @@ async def launch_persistent_context(
context._options = params
return context
except Exception as e:
if "because executable doesn't exist" in str(e):
if "npx playwright install" in str(e):
raise not_installed_error(f'"{self.name}" browser was not found.')
raise e

Expand Down
11 changes: 11 additions & 0 deletions playwright/_impl/_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,17 @@ async def hover(
) -> None:
await self._channel.send("hover", locals_to_params(locals()))

async def drag_and_drop(
self,
source: str,
target: str,
force: bool = None,
noWaitAfter: bool = None,
timeout: float = None,
trial: bool = None,
) -> None:
await self._channel.send("dragAndDrop", locals_to_params(locals()))

async def select_option(
self,
selector: str,
Expand Down
11 changes: 11 additions & 0 deletions playwright/_impl/_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,17 @@ async def hover(
) -> None:
return await self._main_frame.hover(**locals_to_params(locals()))

async def drag_and_drop(
self,
source: str,
target: str,
force: bool = None,
noWaitAfter: bool = None,
timeout: float = None,
trial: bool = None,
) -> None:
return await self._main_frame.drag_and_drop(**locals_to_params(locals()))

async def select_option(
self,
selector: str,
Expand Down
190 changes: 141 additions & 49 deletions playwright/async_api/_generated.py

Large diffs are not rendered by default.

190 changes: 141 additions & 49 deletions playwright/sync_api/_generated.py

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
InWheel = None
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand

driver_version = "1.13.0-next-1626254028000"
driver_version = "1.13.0-1626733671000"


def extractall(zip: zipfile.ZipFile, path: str) -> None:
Expand Down
1 change: 0 additions & 1 deletion tests/assets/drag-n-drop.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
ev.preventDefault();
var data = ev.dataTransfer.getData("text");
ev.target.appendChild(document.getElementById(data));
ev.dataTransfer.clearData();
}
</script>

Expand Down
11 changes: 1 addition & 10 deletions tests/async/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ async def test_browser_type_launch_should_reject_if_executable_path_is_invalid(
await browser_type.launch(
**launch_arguments, executable_path="random-invalid-path"
)
assert "browser was not found" in exc.value.message
assert "executable doesn't exist" in exc.value.message


async def test_browser_type_executable_path_should_work(browser_type, browser_channel):
Expand Down Expand Up @@ -102,15 +102,6 @@ async def test_browser_close_should_be_callable_twice(browser_type, launch_argum
await browser.close()


async def test_browser_launch_non_existing_executable_path_shows_install_msg(
browser_type,
tmpdir,
):
with pytest.raises(Error) as exc_info:
await browser_type.launch(executable_path=tmpdir.join("executable"))
assert "python -m playwright install" in exc_info.value.message


@pytest.mark.only_browser("chromium")
async def test_browser_launch_should_return_background_pages(
browser_type: BrowserType,
Expand Down
11 changes: 11 additions & 0 deletions tests/async/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -1270,3 +1270,14 @@ async def test_input_value(page: Page, server: Server):

await page.fill("input", "")
assert await page.input_value("input") == ""


async def test_drag_and_drop_helper_method(page: Page, server: Server):
await page.goto(server.PREFIX + "/drag-n-drop.html")
await page.drag_and_drop("#source", "#target")
assert (
await page.eval_on_selector(
"#target", "target => target.contains(document.querySelector('#source'))"
)
is True
)
11 changes: 11 additions & 0 deletions tests/sync/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,14 @@ def test_input_value(page: Page, server: Server):

page.fill("input", "")
assert page.input_value("input") == ""


def test_drag_and_drop_helper_method(page: Page, server: Server):
page.goto(server.PREFIX + "/drag-n-drop.html")
page.drag_and_drop("#source", "#target")
assert (
page.eval_on_selector(
"#target", "target => target.contains(document.querySelector('#source'))"
)
is True
)