In chrome browser, when logged into any site with credentials, save password dialog pops up near to address bar,
This pops up because “Offer to save passwords…” option is checked under
Chrome Settings | Show Advanced Settings… | Password and forms section
Manually we can uncheck to disable the popup.
but in this post we will see how we can achieve using selenium
We will use below 2 preferences with ChromeOptions to disable ‘save password’ dialog
prefs.put("credentials_enable_service", false);
prefs.put("profile.password_manager_enabled", false);
Let’s see the implementation
System.setProperty("webdriver.chrome.driver","./chromedriver.exe"); ChromeOptions options = new ChromeOptions(); Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("credentials_enable_service", false); prefs.put("profile.password_manager_enabled", false); options.setExperimentalOption("prefs", prefs); driver = new ChromeDriver(options); driver.get("https://www.saucedemo.com/"); driver.findElement(By.id("user-name")).sendKeys("standard_user"); driver.findElement(By.id("password")).sendKeys("secret_sauce"); driver.findElement(By.id("login-button")).click();
Works perfectly!! Thanks!!
Helped me .. Thank u