Пример #1
0
 async def evaluate(self, expression: str, arg: Serializable = None) -> Any:
     return parse_result(await self._channel.send(
         "evaluateExpression",
         dict(
             expression=expression,
             arg=serialize_argument(arg),
         ),
     ))
Пример #2
0
 async def eval_on_selector_all(
     self,
     selector: str,
     expression: str,
     arg: Serializable = None,
 ) -> Any:
     return parse_result(await self._channel.send(
         "evalOnSelectorAll",
         dict(
             selector=selector,
             expression=expression,
             arg=serialize_argument(arg),
         ),
     ))
Пример #3
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),
         ),
     ))
Пример #4
0
 async def eval_on_selector(
     self,
     selector: str,
     expression: str,
     arg: Serializable = None,
     force_expr: bool = None,
 ) -> Any:
     return parse_result(await self._channel.send(
         "evalOnSelector",
         dict(
             selector=selector,
             expression=expression,
             isFunction=not (force_expr),
             arg=serialize_argument(arg),
         ),
     ))
Пример #5
0
 async def eval_on_selector(
     self,
     selector: str,
     expression: str,
     arg: Serializable = None,
     strict: bool = None,
 ) -> Any:
     return parse_result(await self._channel.send(
         "evalOnSelector",
         locals_to_params(
             dict(
                 selector=selector,
                 expression=expression,
                 arg=serialize_argument(arg),
                 strict=strict,
             )),
     ))
Пример #6
0
 async def send(self, method: str, params: Dict = None) -> Dict:
     result = await self._channel.send("send", locals_to_params(locals()))
     return parse_result(result)
Пример #7
0
 def _on_event(self, params: Any) -> None:
     self.emit(params["method"], parse_result(params["params"]))