chrome.py (794B)
1 import pytest 2 from webdriver.bidi.modules.script import ContextTarget 3 4 pytestmark = pytest.mark.asyncio 5 6 7 @pytest.mark.allow_system_access 8 @pytest.mark.parametrize( 9 "expression, expected_value", 10 [ 11 ( 12 "ChromeUtils.getClassName(document.defaultView)", 13 {"type": "string", "value": "Window"}, 14 ), 15 ( 16 "Ci.nsICookie.SAMESITE_STRICT", 17 {"type": "number", "value": 2}, 18 ), 19 ], 20 ids=["chrome-utils", "interface"], 21 ) 22 async def test_target_context(bidi_session, chrome_context, expression, expected_value): 23 result = await bidi_session.script.evaluate( 24 expression=expression, 25 target=ContextTarget(chrome_context["context"]), 26 await_promise=False, 27 ) 28 29 assert result == expected_value