Selenium: Fix Chrome's "Unsafe Password" Warning

Posted . Visible to the public.

tl;dr

Set profile.password_manager_leak_detection to false in your Selenium Chrome options to disable password leak detection and suppress the warning.

Problem

When running Selenium tests with recent versions of Chrome and Chromedriver (e.g., version 136+), entering “unsafe” (weak or reused) passwords in forms triggers a browser warning:

"This password has appeared in a data breach…"

This alert can break automated test runs, especially in CI/CD pipelines.

Solution

You can disable Chrome’s password leak detection to prevent this warning from appearing.

Add the following Chrome preference to your Selenium driver configuration:

options = Selenium::WebDriver::Chrome::Options.new
options.add_preference('profile.password_manager_leak_detection', false)

This disables the feature that checks if a password has been leaked or is unsafe, which in turn suppresses the warning dialog.

Julian
License
Source code in this card is licensed under the MIT License.
Posted by Julian to makandra dev (2025-05-21 11:26)