(page: Page)
| 21 | |
| 22 | @pytest.mark.only_browser("chromium") |
| 23 | async def test_should_work(page: Page) -> None: |
| 24 | client = await page.context.new_cdp_session(page) |
| 25 | events = [] |
| 26 | client.on("Runtime.consoleAPICalled", lambda params: events.append(params)) |
| 27 | await client.send("Runtime.enable") |
| 28 | result = await client.send( |
| 29 | "Runtime.evaluate", |
| 30 | {"expression": "window.foo = 'bar'; console.log('log'); 'result'"}, |
| 31 | ) |
| 32 | assert result == {"result": {"type": "string", "value": "result"}} |
| 33 | foo = await page.evaluate("() => window.foo") |
| 34 | assert foo == "bar" |
| 35 | assert events[0]["args"][0]["value"] == "log" |
| 36 | |
| 37 | |
| 38 | @pytest.mark.only_browser("chromium") |
nothing calls this directly
no test coverage detected