diff --git a/remote/shared/webdriver/Capabilities.sys.mjs b/remote/shared/webdriver/Capabilities.sys.mjs index ea978ba76a08..1a0dd4cbf977 100644 --- a/remote/shared/webdriver/Capabilities.sys.mjs +++ b/remote/shared/webdriver/Capabilities.sys.mjs @@ -47,7 +47,6 @@ export const WEBDRIVER_CLASSIC_CAPABILITIES = [ "pageLoadStrategy", "strictFileInteractability", "timeouts", - "unhandledPromptBehavior", "webSocketUrl", // Gecko specific capabilities diff --git a/remote/shared/webdriver/test/xpcshell/test_Session.js b/remote/shared/webdriver/test/xpcshell/test_Session.js index 149479efc47e..bc86f3428df5 100644 --- a/remote/shared/webdriver/test/xpcshell/test_Session.js +++ b/remote/shared/webdriver/test/xpcshell/test_Session.js @@ -72,7 +72,7 @@ add_task(function test_WebDriverSession_ctor() { // BiDi session session = createSession({ capabilities, isBidi: true }); equal(session.acceptInsecureCerts, true); - equal(session.userPromptHandler.toJSON(), "dismiss and notify"); + equal(session.userPromptHandler.toJSON(), "ignore"); equal(session.pageLoadStrategy, undefined); equal(session.strictFileInteractability, undefined); diff --git a/remote/webdriver-bidi/test/browser/browser_WebDriverBiDi.js b/remote/webdriver-bidi/test/browser/browser_WebDriverBiDi.js index 3dbc0e9ce769..008bdf1756c9 100644 --- a/remote/webdriver-bidi/test/browser/browser_WebDriverBiDi.js +++ b/remote/webdriver-bidi/test/browser/browser_WebDriverBiDi.js @@ -114,7 +114,7 @@ add_task(async function test_createSession() { wdBiDi => { is(wdBiDi.session.bidi, true); is(wdBiDi.session.acceptInsecureCerts, true); - is(wdBiDi.session.userPromptHandler.toJSON(), "dismiss and notify"); + is(wdBiDi.session.userPromptHandler.toJSON(), "ignore"); is(wdBiDi.session.pageLoadStrategy, undefined); is(wdBiDi.session.strictFileInteractability, undefined); diff --git a/testing/web-platform/mozilla/tests/webdriver/bidi/session/new/capabilities.py b/testing/web-platform/mozilla/tests/webdriver/bidi/session/new/capabilities.py index a63afc8d7ac4..80ab5820b732 100644 --- a/testing/web-platform/mozilla/tests/webdriver/bidi/session/new/capabilities.py +++ b/testing/web-platform/mozilla/tests/webdriver/bidi/session/new/capabilities.py @@ -49,6 +49,47 @@ async def test_proxy( assert response == {"type": "string", "value": page_content} +@pytest.mark.parametrize( + "value", + [ + None, + "accept", + "accept and notify", + "dismiss", + "dismiss and notify", + "ignore", + ], +) +async def test_unhandledPromptBehavior_string(new_session, match_capabilities, value): + capabilities = match_capabilities("alwaysMatch", "unhandledPromptBehavior", value) + + bidi_session = await new_session(capabilities=capabilities) + + if value is None: + assert ( + bidi_session.capabilities.get("unhandledPromptBehavior") + == "dismiss and notify" + ) + else: + assert bidi_session.capabilities.get("unhandledPromptBehavior") == value + + +@pytest.mark.parametrize("handler", ["accept", "dismiss", "ignore"]) +@pytest.mark.parametrize("prompt_type", ["alert", "beforeUnload", "confirm", "prompt"]) +async def test_unhandledPromptBehavior_object( + new_session, match_capabilities, handler, prompt_type +): + capabilities = match_capabilities( + "alwaysMatch", "unhandledPromptBehavior", {prompt_type: handler} + ) + + bidi_session = await new_session(capabilities=capabilities) + + assert bidi_session.capabilities.get("unhandledPromptBehavior") == { + prompt_type: handler + } + + @pytest.mark.parametrize("match_type", ["alwaysMatch", "firstMatch"]) async def test_websocket_url(new_session, match_capabilities, match_type): capabilities = match_capabilities(match_type, "webSocketUrl", True)