Skip to content

Commit f0fdb9e

Browse files
committed
[java][js] Fixing prompt/alert related tests if BiDi is enabled
1 parent 3963bb8 commit f0fdb9e

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

java/test/org/openqa/selenium/testing/drivers/Browser.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package org.openqa.selenium.testing.drivers;
1919

2020
import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
21+
import static org.openqa.selenium.remote.CapabilityType.UNHANDLED_PROMPT_BEHAVIOUR;
2122

2223
import java.util.HashMap;
2324
import java.util.Map;
@@ -61,6 +62,9 @@ public Capabilities getCapabilities() {
6162

6263
options.enableBiDi();
6364

65+
// Reason: https://github.com/SeleniumHQ/selenium/pull/14429#issuecomment-2311614822
66+
options.setCapability(UNHANDLED_PROMPT_BEHAVIOUR, "ignore");
67+
6468
return options;
6569
}
6670
},
@@ -91,6 +95,7 @@ public Capabilities getCapabilities() {
9195
options.setExperimentalOption("prefs", prefs);
9296

9397
options.enableBiDi();
98+
options.setCapability(UNHANDLED_PROMPT_BEHAVIOUR, "ignore");
9499

95100
return options;
96101
}

javascript/node/selenium-webdriver/bidi/browsingContextInspector.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ class BrowsingContextInspector {
127127
let response = null
128128
if ('navigation' in params) {
129129
response = new NavigationInfo(params.context, params.navigation, params.timestamp, params.url)
130-
} else if ('type' in params) {
131-
response = new UserPromptOpened(params.context, params.type, params.message)
132130
} else if ('accepted' in params) {
133131
response = new UserPromptClosed(params.context, params.accepted, params.userText)
132+
} else if ('type' in params) {
133+
response = new UserPromptOpened(params.context, params.type, params.message)
134134
} else {
135135
response = new BrowsingContextInfo(params.context, params.url, params.children, params.parent)
136136
}

javascript/node/selenium-webdriver/testing/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,7 @@ class Environment {
346346
// Enable BiDi for supporting browsers.
347347
if (browser.name === Browser.FIREFOX || browser.name === Browser.CHROME || browser.name === Browser.EDGE) {
348348
builder.setCapability('webSocketUrl', true)
349+
builder.setCapability('unhandledPromptBehavior', 'ignore')
349350
}
350351

351352
if (typeof urlOrServer === 'string') {

0 commit comments

Comments
 (0)