如何在黄瓜测试用例中使用selenium web驱动程序安装firefox

时间:2013-03-19 07:03:04

标签: selenium cucumber capybara

我必须编写脚本,我需要安装名为“aqqin”的firefox-add-on。我怎么能这样做

2 个答案:

答案 0 :(得分:4)

您可以通过创建自定义配置文件并将其传递给驱动程序来添加插件。

FirefoxProfile profile = new FirefoxProfile();
File extension = new File("<path>"/aqqin.xpi");
profile.addExtension(extension);

WebDriver driver = new FirefoxDriver(profile);

答案 1 :(得分:1)

含有红宝石代码的硒:

RSpec.configure do |config|
    profile = Selenium::WebDriver::Firefox::Profile.new
    profile.assume_untrusted_certificate_issuer = true
    #profile.add_extension "/usr/lib/firefox-addons/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}"
    Capybara.register_driver :selenium do |app|
        Capybara::Selenium::Driver.new(app, {:browser => :firefox, :profile => "default"} )
        #Capybara::Selenium::Driver.new(app, {:browser => :firefox, :profile => profile} )
    end 
end