Page.expect_popup Performs action and waits for a popup `Page`. If predicate is provided, it passes [Popup] value into the `predicate` function and waits for `predicate(page)` to return a truthy value. Will throw an error if the page is closed before the popup event is fired
(
self,
predicate: typing.Optional[typing.Callable[["Page"], bool]] = None,
*,
timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None,
)
| 13059 | ) |
| 13060 | |
| 13061 | def expect_popup( |
| 13062 | self, |
| 13063 | predicate: typing.Optional[typing.Callable[["Page"], bool]] = None, |
| 13064 | *, |
| 13065 | timeout: typing.Optional[typing.Union[float, datetime.timedelta]] = None, |
| 13066 | ) -> AsyncEventContextManager["Page"]: |
| 13067 | """Page.expect_popup |
| 13068 | |
| 13069 | Performs action and waits for a popup `Page`. If predicate is provided, it passes [Popup] value into the |
| 13070 | `predicate` function and waits for `predicate(page)` to return a truthy value. Will throw an error if the page is |
| 13071 | closed before the popup event is fired. |
| 13072 | |
| 13073 | Parameters |
| 13074 | ---------- |
| 13075 | predicate : Union[Callable[[Page], bool], None] |
| 13076 | Receives the `Page` object and resolves to truthy value when the waiting should resolve. |
| 13077 | timeout : Union[float, None] |
| 13078 | Maximum time to wait for in milliseconds. Defaults to `30000` (30 seconds). Pass `0` to disable timeout. The |
| 13079 | default value can be changed by using the `browser_context.set_default_timeout()`. |
| 13080 | |
| 13081 | Returns |
| 13082 | ------- |
| 13083 | EventContextManager[Page] |
| 13084 | """ |
| 13085 | |
| 13086 | return AsyncEventContextManager( |
| 13087 | self._impl_obj.expect_popup( |
| 13088 | predicate=self._wrap_handler(predicate), |
| 13089 | timeout=to_milliseconds(timeout), |
| 13090 | ).future |
| 13091 | ) |
| 13092 | |
| 13093 | def expect_request( |
| 13094 | self, |
nothing calls this directly
no test coverage detected