diff --git a/tools/webdriver/webdriver/bidi/modules/session.py b/tools/webdriver/webdriver/bidi/modules/session.py index 725aab1bec72fa..843352baaa9c04 100644 --- a/tools/webdriver/webdriver/bidi/modules/session.py +++ b/tools/webdriver/webdriver/bidi/modules/session.py @@ -40,9 +40,14 @@ def subscribe(self, @command def unsubscribe(self, - events: List[str], - contexts: Optional[List[str]] = None) -> Mapping[str, Any]: - params: MutableMapping[str, Any] = {"events": events} + events: Optional[List[str]] = None, + contexts: Optional[List[str]] = None, + subscriptions: Optional[List[str]] = None) -> Mapping[str, Any]: + params: MutableMapping[str, Any] = {} if contexts is not None: params["contexts"] = contexts + if events is not None: + params["events"] = events + if subscriptions is not None: + params["subscriptions"] = subscriptions return params diff --git a/webdriver/tests/bidi/session/unsubscribe/invalid.py b/webdriver/tests/bidi/session/unsubscribe/invalid.py index c286bc09ee04d7..0b13e949673c19 100644 --- a/webdriver/tests/bidi/session/unsubscribe/invalid.py +++ b/webdriver/tests/bidi/session/unsubscribe/invalid.py @@ -198,3 +198,17 @@ async def test_params_unsubscribe_from_one_context_with_global_subscription( # Try to unsubscribe from one context with pytest.raises(InvalidArgumentException): await bidi_session.session.unsubscribe(events=["log.entryAdded"], contexts=[top_context["context"]]) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("subscriptions", [None, True, 42, {}, "foo"]) +async def test_params_subscriptions_invalid_type(bidi_session, subscriptions): + with pytest.raises(InvalidArgumentException): + await bidi_session.session.unsubscribe(subscriptions=subscriptions) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("subscriptions", [[""], ["12345678-1234-5678-1234-567812345678"]]) +async def test_params_subscriptions_invalid_value(bidi_session, subscriptions): + with pytest.raises(InvalidArgumentException): + await bidi_session.session.unsubscribe(subscriptions=subscriptions)