Skip to content

Commit

Permalink
[java][js] Fixing prompt/alert related tests if BiDi is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
pujagani committed Aug 27, 2024
1 parent 3963bb8 commit f0fdb9e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions java/test/org/openqa/selenium/testing/drivers/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.openqa.selenium.testing.drivers;

import static org.openqa.selenium.remote.CapabilityType.BROWSER_NAME;
import static org.openqa.selenium.remote.CapabilityType.UNHANDLED_PROMPT_BEHAVIOUR;

import java.util.HashMap;
import java.util.Map;
Expand Down Expand Up @@ -61,6 +62,9 @@ public Capabilities getCapabilities() {

options.enableBiDi();

// Reason: https://github.com/SeleniumHQ/selenium/pull/14429#issuecomment-2311614822
options.setCapability(UNHANDLED_PROMPT_BEHAVIOUR, "ignore");

return options;
}
},
Expand Down Expand Up @@ -91,6 +95,7 @@ public Capabilities getCapabilities() {
options.setExperimentalOption("prefs", prefs);

options.enableBiDi();
options.setCapability(UNHANDLED_PROMPT_BEHAVIOUR, "ignore");

return options;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ class BrowsingContextInspector {
let response = null
if ('navigation' in params) {
response = new NavigationInfo(params.context, params.navigation, params.timestamp, params.url)
} else if ('type' in params) {
response = new UserPromptOpened(params.context, params.type, params.message)
} else if ('accepted' in params) {
response = new UserPromptClosed(params.context, params.accepted, params.userText)
} else if ('type' in params) {
response = new UserPromptOpened(params.context, params.type, params.message)
} else {
response = new BrowsingContextInfo(params.context, params.url, params.children, params.parent)
}
Expand Down
1 change: 1 addition & 0 deletions javascript/node/selenium-webdriver/testing/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ class Environment {
// Enable BiDi for supporting browsers.
if (browser.name === Browser.FIREFOX || browser.name === Browser.CHROME || browser.name === Browser.EDGE) {
builder.setCapability('webSocketUrl', true)
builder.setCapability('unhandledPromptBehavior', 'ignore')
}

if (typeof urlOrServer === 'string') {
Expand Down

0 comments on commit f0fdb9e

Please sign in to comment.