简体   繁体   中英

Can extensions be installed in Watir's Firefox browser?

I'm trying to use Watir on a page that has a large number of ads and it's really slowing down my tests. Why when Watir launches Firefox do my extensions (Adblock, etc.) not carry over and is it possible to install them?

Yes, you can do it. Let' assume you to want use Firebug extension..

First download the Firebug xpi file, then use the following code:

profile = Selenium::WebDriver::Firefox::Profile.new
profile.add_extension "../path/to/firebug.xpi"
b = Watir::Browser.new :firefox, :profile => profile

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM