diff --git a/playwright/_impl/_locator.py b/playwright/_impl/_locator.py index c2fb16345..0c8353a47 100644 --- a/playwright/_impl/_locator.py +++ b/playwright/_impl/_locator.py @@ -503,3 +503,6 @@ def last(self) -> "FrameLocator": def nth(self, index: int) -> "FrameLocator": return FrameLocator(self._frame, f"{self._frame_selector} >> nth={index}") + + def __repr__(self) -> str: + return f"" diff --git a/tests/sync/test_locators.py b/tests/sync/test_locators.py index 4c0dd5401..db4b72d54 100644 --- a/tests/sync/test_locators.py +++ b/tests/sync/test_locators.py @@ -496,6 +496,10 @@ def test_locators_frame_should_work_with_iframe(page: Page, server: Server) -> N button.wait_for() assert button.inner_text() == "Hello iframe" button.click() + assert ( + repr(page.frame_locator("iframe")) + == f" selector='iframe'>" + ) def test_locators_frame_should_work_for_nested_iframe(