I am not able to click on the Allow button of access camera authentication popup in Firefox browser using Selenium WebDriver
with Java.
Below is the code which is using:
Map<String, Object> prefs = new HashMap<String, Object>();
WebDriverManager.firefoxdriver().setup();
prefs.put("profile.default_content_setting_values.media_stream_mic", 1);
prefs.put("profile.default_content_setting_values.media_stream_camera", 1);
prefs.put("profile.default_content_setting_values.notifications", 1);
prefs.put("credentials_enable_service", false);
prefs.put("profile.password_manager_enabled", false);
FirefoxOptions options = new FirefoxOptions();
options.addPreference("dom.webnotifications.enabled", false);
options.addArguments("--disable-infobars");
options.addArguments("use-fake-ui-for-media-stream");
options.addArguments("start-maximized");
options.addArguments("--disable-extensions");
driver = new FirefoxDriver(options);
Here is the look of popup:
To handle the basic authentication popup, we can pass the username and password along with the web page's URL. When the login pop-up is prompted, we enter the username as “admin” and the password as “admin” and then login. Thus, the user would be successfully logged into the website.
You can use the following preferences (in this case to allow):
...
options.addPreference("permissions.default.microphone", 1);
options.addPreference("permissions.default.camera", 1);
...
Hope it helps you!
I am using these options to my firefox driver, it's perfectly working
public static FirefoxOptions setFireFoxOptions() {
FirefoxOptions options = new FirefoxOptions();
options.addPreference("media.navigator.permission.disabled", true);
return options;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With