Beispiel #1
0
 async def evaluateHandle(self,
                          expression: str,
                          arg: Serializable = None,
                          force_expr: bool = None) -> "JSHandle":
     if not is_function_body(expression):
         force_expr = True
     return from_channel(await self._channel.send(
         "evaluateExpressionHandle",
         dict(
             expression=expression,
             isFunction=not (force_expr),
             arg=serialize_argument(arg),
         ),
     ))
Beispiel #2
0
 async def evaluate(self,
                    expression: str,
                    arg: Serializable = None,
                    force_expr: bool = None) -> Any:
     if not is_function_body(expression):
         force_expr = True
     return parse_result(await self._channel.send(
         "evaluateExpression",
         dict(
             expression=expression,
             isFunction=not (force_expr),
             arg=serialize_argument(arg),
         ),
     ))
 async def wait_for_function(
     self,
     expression: str,
     arg: Serializable = None,
     force_expr: bool = None,
     timeout: float = None,
     polling: Union[float, Literal["raf"]] = None,
 ) -> JSHandle:
     if not is_function_body(expression):
         force_expr = True
     params = locals_to_params(locals())
     params["isFunction"] = not (force_expr)
     params["arg"] = serialize_argument(arg)
     return from_channel(await self._channel.send("waitForFunction",
                                                  params))