mokr.frame.wait
Module Contents
Classes
Class used to monitor a remote frame for events to occur within |
Attributes
- mokr.frame.wait.LOGGER
- class mokr.frame.wait.WaitTask(frame: mokr.frame.frame.Frame, predicate_body: str, title: str, polling: Literal[raf, mutation] | int | float, timeout: float, loop: asyncio.AbstractEventLoop, *args: Any)
Class used to monitor a remote frame for events to occur within a given timer interval.
- Parameters:
frame (Frame) –
mokr.frame.Framethat spawned thisWaitTask.predicate_body (str) – JavaScript function to return from.
title (str) – Title to be used to contextualise error, if any.
polling (Literal["raf", "mutation"] | int | float) – Polling type; if set to “raf”, executes continously in “requestAnimationFrame”, else if set to “mutation” executes only on DOM mutations. Defaults to “raf”.
timeout (float) – Time in milliseconds to wait.
loop (asyncio.AbstractEventLoop) – Running asyncio loop.
- Raises:
ValueError – Raised if
polling_typenot “raf” or “mutation”.
- terminate(error: Exception) None
Finish the task, if the promise is still not done, set the result with the given
error, then remove this task from the parentmokr.frame.Frame.- Parameters:
error (Exception) – Error to raise if watched promise isn’t done.