MCPcopy Create free account
hub / github.com/Vinyzu/Botright / test_expose_binding

Function test_expose_binding

tests/playwright_tests/test_page.py:324–338  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

322
323@pytest.mark.asyncio
324async def test_expose_binding(page):
325 binding_source = []
326
327 def binding(source, a, b):
328 binding_source.append(source)
329 return a + b
330
331 await page.expose_binding("add", lambda source, a, b: binding(source, a, b))
332
333 result = await page.evaluate("add(5, 6)")
334
335 assert binding_source[0]["context"] == page.context
336 assert binding_source[0]["page"] == page
337 assert binding_source[0]["frame"] == page.main_frame
338 assert result == 11
339
340
341@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

bindingFunction · 0.70
expose_bindingMethod · 0.45

Tested by

no test coverage detected