diff --git a/playwright/_impl/_frame.py b/playwright/_impl/_frame.py index 2cfbb7240..2ce4372b6 100644 --- a/playwright/_impl/_frame.py +++ b/playwright/_impl/_frame.py @@ -156,7 +156,7 @@ def _setup_navigation_waiter(self, wait_name: str, timeout: float = None) -> Wai waiter.reject_on_event( self._page, "close", - lambda: cast(Page, self._page)._close_error_with_reason(), + lambda: cast("Page", self._page)._close_error_with_reason(), ) waiter.reject_on_event( self._page, "crash", Error("Navigation failed because page crashed!")