Why Selenium started Chrome doesn't show save password dialog?

Viewed 373

I have done a lot of searching on this topic but I never found a working solution.

I believe that I know a lot about Selenium and I don't understand why things not working for me on Chrome, but working on Edge (Chromium-Based)

Starting browser with Selenium

I use the same method to start both Edge (89.0.774.54) and Chrome (89.0.4389.90).

  • Using C# with OpenQA.Selenium (4.0.0-beta2)
  • I add user-data-dir argument to set up a profile path (but the path is empty, so the profile is generated by Selenium / Browser at startup)
  • For chromeOptions / edgeOptions I set up Eager PageLoadStrategy
  • I set up deleteDataPostSession preference to false

** Save Password Dialog on Chrome **

This Save Password Dialog is not appearing on the Chrome started by my Selenium Code. enter image description here

(This screenshot was created in my regular chrome)

Also, this Password generation thing doesn't appear as well.

enter image description here

Save Password Dialog on Edge

This Save Password Dialog is appearing on Edge started by my Selenium Code. enter image description here

What I have tried to solve the issue

I try to explicitly tell to Chrome to show these dialogs

chromeOptions.AddUserProfilePreference("credentials_enable_service", true);
chromeOptions.AddUserProfilePreference("profile.password_manager_enabled", true);

This experiment was based on this answer where someone tries to disable the dialog.

Preference files

I also analyzed my CHROME-PROFILE-PATH/Default/Preferences file to see what is happening.

Originally profile.password_manager_enabled and credentials_enable_service was false, but after adding the above lines they became true.

On Edge, despite the profile.password_manager_enabled value is false the dialog appears.

I have also used a diff tool to compare the chrome-preferences with my regular chrome's preferences. After that I added this code but also didn't work:

chromeOptions.AddUserProfilePreference("autofill.enabled", true);
chromeOptions.AddUserProfilePreference("autofill.profile_enabled", true);

I open the chrome://flags page and search for "password" and enable everything. Then I restart chrome but still not working.

I'm out of ideas. What am I missing?

I also attach the started browser's preferences. Please note that I used ... at some places where it was irrelevant to reduce the size of the json.

Chrome

{
   "account_id_migration_state":2,
   "account_tracker_service_last_update":"13263555192369766",
   "alternate_error_pages":{
      "backup":false
   },
   "autocomplete":{
      "retention_policy_last_version":89
   },
   "autofill":{
      "credit_card_enabled":true,
      "enabled":true,
      "profile_enabled":true
   },
   "browser":{
      "check_default_browser":false,
      "window_placement":{
         ...
      }
   },
   "countryid_at_install":18517,
   "credentials_enable_service":true,
   "data_reduction":{
      "this_week_number":2677,
      "this_week_services_downstream_foreground_kb":{
         "112189210":0,
         "35473769":39,
         "35565745":1,
         "67052219":1,
         "78917933":40
      }
   },
   "deleteDataPostSession":false,
   "distribution":{
      "import_bookmarks":false,
      "import_history":false,
      "import_search_engine":false,
      "make_chrome_default_for_user":false,
      "skip_first_run_ui":true
   },
   "dns_prefetching":{
      "enabled":false
   },
   "domain_diversity":{
      "last_reporting_timestamp":"13263555192370142"
   },
   "extensions":{
      ...
   },
   "gaia_cookie":{
      "changed_time":1619081592.874476,
      "hash":"2jmj7l5rSw0yVb/vlWAYkK/YBwk=",
      "last_list_accounts_data":"[\"gaia.l.a.r\",[]\n]\n"
   },
   "gcm":{
      "product_category_for_subtypes":"com.chrome.windows"
   },
   "google":{
      "services":{
         "signin_scoped_device_id":"e9f1244d-0b34-4a77-882f-15bde9b4fb4a"
      }
   },
   "invalidation":{
      "per_sender_topics_to_handler":{
         "1013309121859":{
            
         },
         "8181035976":{
            
         }
      }
   },
   "media":{
      "device_id_salt":"665A83F3FBD965308E0976EAD9EC4CD6",
      "engagement":{
         "schema_version":4
      }
   },
   "media_router":{
      "receiver_id_hash_token":"cD0cqbJXrXyOARTWI2YvIQr0BfDh+mraks4pAdMG9mW1TI6WL4577DL/KpW4f/GOVPr3giW+QD1I+HmZPTYhMA=="
   },
   "ntp":{
      "custom_background_local_to_device":false,
      "num_personal_suggestions":1
   },
   "plugins":{
      "plugins_list":[
         
      ]
   },
   "previews":{
      "litepage":{
         "user-needs-notification":false
      }
   },
   "profile":{
      "avatar_index":26,
      "content_settings":{
         "enable_quiet_permission_ui_enabling_method":{
            "notifications":1
         },
         "exceptions":{
            ...
         },
         "pattern_pairs":{
            "https://*,*":{
               "media-stream":{
                  "audio":"Default",
                  "video":"Default"
               }
            }
         },
         "pref_version":1
      },
      "creation_time":"13263555191826958",
      "default_content_setting_values":{
         "geolocation":1
      },
      "default_content_settings":{
         "geolocation":1,
         "mouselock":1,
         "notifications":1,
         "popups":1,
         "ppapi-broker":1
      },
      "exit_type":"Crashed",
      "exited_cleanly":true,
      "last_engagement_time":"13263555193102304",
      "managed_user_id":"",
      "name":"Person 1",
      "password_manager_enabled":true
   },
   "safebrowsing":{
      "enabled":false,
      "metrics_last_log_time":"13263555192"
   },
   "search":{
      "suggest_enabled":false
   },
   "signin":{
      "DiceMigrationComplete":true,
      "allowed":true
   },
   "spellcheck":{
      "dictionaries":[
         "en-US"
      ],
      "dictionary":""
   },
   "token_service":{
      "dice_compatible":true
   },
   "translate":{
      "enabled":false
   },
   "translate_site_blacklist_with_time":{
      
   },
   "web_apps":{
      "did_migrate_default_chrome_apps":[
         
      ],
      "last_preinstall_synchronize_version":"89",
      "system_web_app_failure_count":0,
      "system_web_app_last_attempted_language":"en-US",
      "system_web_app_last_attempted_update":"89.0.4389.90",
      "system_web_app_last_installed_language":"en-US",
      "system_web_app_last_update":"89.0.4389.90"
   }
}

Edge

{
   "account_id_migration_state":2,
   "account_info":[
      
   ],
   "account_tracker_service_last_update":"13263555672046796",
   "alternate_error_pages":{
      "backup":false
   },
   "autocomplete":{
      "retention_policy_last_version":89
   },
   "autofill":{
      "credit_card_enabled":false,
      "enabled":false,
      "orphan_rows_removed":true,
      "profile_enabled":false
   },
   "browser":{
      "available_dark_theme_options":"All",
      "check_default_browser":false,
      "window_placement":{
         ...
      }
   },
   "browser_content_container_height":717,
   "browser_content_container_width":1036,
   "browser_content_container_x":0,
   "browser_content_container_y":80,
   "countryid_at_install":18517,
   "custom_links":{
      "list":[
         
      ]
   },
   "data_reduction":{
      "this_week_number":2677,
      "this_week_services_downstream_foreground_kb":{
         "106770712":1,
         "109536380":66,
         "12038966":0,
         "52513318":1,
         "54366456":2,
         "91564202":0
      }
   },
   "distribution":{
      "import_bookmarks":false,
      "import_history":false,
      "import_search_engine":false,
      "make_chrome_default_for_user":false,
      "skip_first_run_ui":true
   },
   "dns_prefetching":{
      "enabled":false
   },
   "domain_diversity":{
      "last_reporting_timestamp":"13263555672045746"
   },
   "download":{
      "directory_upgrade":true
   },
   "dual_engine":{
      "profile_id":"4C50PPVO",
      "shared_cookie_data":{
         
      },
      "sitelist_data_1":{
         
      },
      "sitelist_location":"",
      "sitelist_version":""
   },
   "edge":{
      "profile_sso_info":{
         "aad_sso_algo_state":1,
         "is_first_profile":true
      },
      "profile_sso_option":1,
      "services":{
         "signin_scoped_device_id":"5b695de1-5bf8-4307-845d-976fac08b6b8"
      }
   },
   "extensions":{
      "alerts":{
         "initialized":true
      },
      "chrome_url_overrides":{
         
      }
   },
   "family_safety":{
      "activity_reporting_enabled":false,
      "web_filtering_enabled":false
   },
   "media":{
      "device_id_salt":"23B14A71ACE1DFD23CFCDB82B7EFF3D7",
      "engagement":{
         "schema_version":4
      }
   },
   "media_router":{
      "receiver_id_hash_token":"he+v3KvQISCtpqAi1OSQ4yFwK1J1C8hvME9++hxTYdBgBEtTSH8FPbmRNKL1Pu/6zcx7FpLD9i0TG5frhhLomQ=="
   },
   "ntp":{
      "num_personal_suggestions":2
   },
   "plugins":{
      "plugins_list":[
         
      ]
   },
   "previews":{
      "litepage":{
         "user-needs-notification":false
      }
   },
   "profile":{
      "avatar_index":20,
      "content_settings":{
         "enable_quiet_permission_ui_enabling_method":{
            "notifications":2
         },
         "exceptions":{
            ...
         },
         "pattern_pairs":{
            "https://*,*":{
               "media-stream":{
                  "audio":"Default",
                  "video":"Default"
               }
            }
         },
         "pref_version":1
      },
      "creation_time":"13263555671479203",
      "default_content_setting_values":{
         "geolocation":1
      },
      "default_content_settings":{
         "geolocation":1,
         "mouselock":1,
         "notifications":1,
         "popups":1,
         "ppapi-broker":1
      },
      "exit_type":"Crashed",
      "exited_cleanly":true,
      "last_engagement_time":"13263555673751442",
      "managed_user_id":"",
      "name":"Profile 1",
      "observed_session_time":{
         "feedback_rating_in_product_help_observed_session_time_key_89.0.774.54":17.0
      },
      "password_hash_data_list":[
         
      ],
      "password_manager_enabled":false,
      "using_default_avatar":false,
      "using_gaia_avatar":false
   },
   "reset_prepopulated_engines":false,
   "safebrowsing":{
      "advanced_protection_last_refresh":"13263555683753670",
      "enabled":false,
      "metrics_last_log_time":"13263555671"
   },
   "search":{
      "suggest_enabled":false
   },
   "settings":{
      "a11y":{
         "caretbrowsing":{
            "enabled":false
         }
      }
   },
   "signin":{
      "allowed":true
   },
   "spellcheck":{
      "dictionaries":[
         "en-US"
      ],
      "dictionary":""
   },
   "translate":{
      "enabled":false
   },
   "translate_site_blacklist_with_time":{
      
   },
   "web_apps":{
      "did_migrate_default_chrome_apps":[
         
      ],
      "last_preinstall_synchronize_version":"89",
      "system_web_app_failure_count":0,
      "system_web_app_last_attempted_language":"en-US",
      "system_web_app_last_attempted_update":"89.0.774.54",
      "system_web_app_last_installed_language":"en-US",
      "system_web_app_last_update":"89.0.774.54"
   }
}
1 Answers

This was missing

chromeOptions.AddExcludedArgument("enable-automation");
Related