有時(shí)候我們需要在使用firefox測(cè)試時(shí)啟動(dòng)firebug,這時(shí)候就可以用到下面的代碼
1 2 3 4 5 6 | require 'rubygems' require 'selenium-webdriver' profile = Selenium::WebDriver::Firefox::Profile. new profile.add_extension 'where/the/extensions/locate/firebug.xpi' dr = Selenium::WebDriver. for :firefox , :profile => profile |
這段代碼首先創(chuàng)建了1個(gè)新的firefox profile,然后將firebug的擴(kuò)展配置到該profile中去。
另外也可以看出,通過指定不同的profile可以起到配置firefox的功能
聯(lián)系客服