我有以下代码:
Capybara.register_driver :selenium do |app|
driver = Capybara::Selenium::Driver.new(app, browser: :firefox, profile: "selenium")
driver.browser.manage.window.resize_to(600,800)
driver
end
在运行测试期间,有一个带证书的弹出窗口,所以每次我都要按它。
如何自动执行此操作,或将Capybara firefox配置文件配置为自动接受证书?
答案 0 :(得分:1)
根据记录here,您需要在assume_untrusted_certificate_issuer
上将false
设置为Firefox::Profile
。例如:
Capybara.register_driver :selenium do |app|
profile = Selenium::WebDriver::Firefox::Profile.new
profile.assume_untrusted_certificate_issuer = false # <= this should work
driver = Capybara::Selenium::Driver.new(app, :profile => profile)
driver.browser.manage.window.resize_to(600,800)
driver
end
如果您想了解firefox驱动程序的详细信息,请参阅http://code.google.com/p/selenium/wiki/UntrustedSSLCertificates