-
-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Description
Description
Starting from Chrome 137 it's unable to manage browser prompts (alerts) using BiDi driver. Issues on ChromeDriver were created, but they were closed as intendent behavior:
https://issues.chromium.org/issues/425390962
https://issues.chromium.org/issues/428153658
Based on the specification we should provide unhandledPromptBehavior as a dictionary. Based on the comment in the issue it's possible to do it for java, using MutableCapabilities, but I didn't find any solution for c#.
In my project I use Selenium 4.23 + .net 4.7.2. I tried the following code:
var promptBehavior = new Dictionary<string, string>
{
{"alert", "ignore"},
{"confirm", "ignore"},
{"prompt", "ignore"},
{"beforeUnload", "ignore"},
{"default", "ignore"}
};
options.AddAdditionalOption("unhandledPromptBehavior", promptBehavior);
But exception is thrown : System.ArgumentException: 'There is already an option for the unhandledPromptBehavior capability. Please use the UnhandledPromptBehavior property instead.
Parameter name: capabilityName'
I can't set dictionary to the options.UnhandledPromptBehavior either, because it's waiting for the UnhandledPromptBehavior map (for example, UnhandledPromptBehavior.Ignore).
Before Selenium 4 we were able to set capabilities via DesiredCapabilities, but in Selenium 4.23 this class is internal.
So, it seems, that there are no possibility to set dictionary to the unhandledPromptBehavior option when starting Chrome Driver.
Note: everything worked fine till Chrome 137.
Reproducible Code
1. Start Chrome 137+ using BiDi ChromeDriver and use the following Chrome options:
options.UseWebSocketUrl = true;
options.UnhandledPromptBehavior = UnhandledPromptBehavior.Ignore;
Actual result: browser alert is not shown
Expected result: alert is shown, because UnhandledPromptBehavior was set to Ignore.
Possible reason: value for UnhandledPromptBehavior is not a dictionary.