diff --git a/playwright/_impl/_video.py b/playwright/_impl/_video.py index e991803e3..0d64866a7 100644 --- a/playwright/_impl/_video.py +++ b/playwright/_impl/_video.py @@ -40,7 +40,7 @@ async def path(self) -> pathlib.Path: ) if not self._artifact: raise Error("Video recording has not been started.") - return self._artifact.absolute_path + return pathlib.Path(self._artifact.absolute_path) async def save_as(self, path: Union[str, pathlib.Path]) -> None: if self._page._connection._is_sync and not self._page._is_closed: diff --git a/tests/async/test_video.py b/tests/async/test_video.py index 08d757794..4b916d5f0 100644 --- a/tests/async/test_video.py +++ b/tests/async/test_video.py @@ -27,6 +27,7 @@ async def test_should_expose_video_path( await page.goto(server.PREFIX + "/grid.html") assert page.video path = await page.video.path() + assert isinstance(path, Path) assert str(tmp_path) in str(path) await page.context.close() diff --git a/tests/sync/test_video.py b/tests/sync/test_video.py index 3ae1daa21..3fd49ad93 100644 --- a/tests/sync/test_video.py +++ b/tests/sync/test_video.py @@ -32,6 +32,7 @@ def test_should_expose_video_path( video = page.video assert video path = video.path() + assert isinstance(path, Path) assert repr(page.video) == f"