chrome.py (857B)
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 "function_declaration, 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( 23 bidi_session, chrome_context, function_declaration, expected_value 24 ): 25 result = await bidi_session.script.call_function( 26 function_declaration=function_declaration, 27 await_promise=False, 28 target=ContextTarget(chrome_context["context"]), 29 ) 30 31 assert result == expected_value