【问题标题】:Configure Selenium - Capybara on Chrome在 Chrome 上配置 Selenium - Capybara
【发布时间】:2015-10-29 17:14:23
【问题描述】:

在使用 Capybara 进行测试时,我使用 Chrome 作为我的默认用户。我想要做的是配置该 chrome 实例,使其不建议在登录页面上记住用户名和密码。

我该怎么做?

【问题讨论】:

    标签: google-chrome selenium capybara configure


    【解决方案1】:

    我觉得你应该自定义Chrome's profile

    尝试将extensions.password_manager_enabled设置为false:

    Capybara.register_driver :chrome do |app|
      profile = Selenium::WebDriver::Chrome::Profile.new
      profile['extensions.password_manager_enabled'] = false
      Capybara::Selenium::Driver.new(app, :browser => :chrome, profile: profile)
    end
    

    如果不起作用,请查看其他 Chrome 偏好设置和开关。

    【讨论】:

    • 我收到此错误“NameError: uninitialized constant Selenium”我必须包含任何特定文件吗?
    • @AlperMermer 你应该require 'selenium-webdriver'
    • profile['extensions.password_manager_enabled'] = false 不起作用。找到了这段代码,但它没有工作 profile['autologin.enabled'] = false
    猜你喜欢
    • 2019-08-08
    • 1970-01-01
    • 1970-01-01
    • 2023-03-13
    • 2020-07-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-24
    相关资源
    最近更新 更多