MCPcopy Index your code
hub / github.com/microsoft/playwright-python / _expect

Method _expect

playwright/_impl/_frame.py:183–226  ·  view source on GitHub ↗
(
        self,
        selector: Optional[str],
        expression: str,
        options: FrameExpectOptions,
        title: str = None,
    )

Source from the content-addressed store, hash-verified

181 return waiter
182
183 async def _expect(
184 self,
185 selector: Optional[str],
186 expression: str,
187 options: FrameExpectOptions,
188 title: str = None,
189 ) -> FrameExpectResult:
190 if "expectedValue" in options:
191 options["expectedValue"] = serialize_argument(options["expectedValue"])
192 try:
193 await self._channel.send(
194 "expect",
195 self._timeout,
196 {
197 "selector": selector,
198 "expression": expression,
199 **options,
200 },
201 title=title,
202 )
203 return {"matches": not options.get("isNot")}
204 except Error as e:
205 if not e._details:
206 raise e
207 details = cast(Dict[str, Any], e._details)
208 received = details.get("received")
209 if received:
210 received = {
211 "value": (
212 parse_value(received["value"]) if "value" in received else None
213 ),
214 "ariaSnapshot": received.get("ariaSnapshot"),
215 }
216 return {
217 "matches": bool(options.get("isNot")),
218 "received": received,
219 "timedOut": details.get("timedOut"),
220 "errorMessage": (
221 "Error: " + details["customErrorMessage"]
222 if details.get("customErrorMessage")
223 else None
224 ),
225 "log": e._log,
226 }
227
228 def expect_navigation(
229 self,

Callers 2

_call_expectMethod · 0.45
_call_expectMethod · 0.45

Calls 4

serialize_argumentFunction · 0.90
parse_valueFunction · 0.90
sendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected