WebDriver Chrome Browser: Avoid 'Do you want chrome to save your password' pop up

前端 未结 8 1272
故里飘歌
故里飘歌 2020-12-11 01:07

Every time my webdriver tests login into the application, \'Do you want chrome to save your password\' pop up appears.. Is there a way to avoid this??

Please help.

相关标签:
8条回答
  • 2020-12-11 01:37

    I'm using Python, and this worked for me:

    from selenium import webdriver
    from selenium.webdriver.chrome.options import Options
    chrome_options = Options()
    chrome_options.add_experimental_option('prefs', {
        'credentials_enable_service': False,
        'profile': {
            'password_manager_enabled': False
        }
    })
    driver = webdriver.Chrome(chrome_options=chrome_options)
    driver.get('https://google.com')
    
    0 讨论(0)
  • 2020-12-11 01:45

    To provide a more complete picture, here is a working configuration for Watir in a Selenium Grid:

    RSpec.configure do |config|
      config.before :all do
        capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
          chromeOptions: {
              prefs: {
                  'credentials_enable_service': false,
                  'profile': {
                      'password_manager_enabled': false
                  }
              }
          }
        )
    
        @browser = Watir::Browser.new(
          :remote,
          url: "http://#{ENV.fetch('HUB_HOST')}/wd/hub",
          desired_capabilities: capabilities
        )
      end
    
      config.after :all do
        @browser&.close
      end
    end
    

    See a full proof of concept on github at docker-grid-watir.

    0 讨论(0)
提交回复
热议问题