Can Watir interact with Firefox Extensions?

1.4k Views Asked by At

I know that with watir-WebDriver, I can make use of RubyBindings to have the browser load specific profiles or Firefox add-ons when I create a new browser instance. However, can I use Watir to actually use the add-on(s) I open?

The reason I ask is that I am trying to implement a web scraper to navigate to websites and record HTTP interactions. However, since Tamper Data already does the HTTP request/response logging I require, I'd rather use its functionality instead of having to redo it myself.

If this is not possible, I'm wondering if anyone knows a unit tester that will allow me to:

  1. Open a Firefox browser & load Tamper Data
  2. Navigate to specified pages
  3. Click a button on Tamper Data's UI
2

There are 2 best solutions below

0
Johny Cash On BEST ANSWER

You can't interact with extensions using bare watir/webdriver as far as i know, need to find a workaround ... Try something like rautomation - https://github.com/jarmo/RAutomation or autoit - http://www.autoitscript.com/site/

3
Chris Billante On

This works for me to launch firebug:

Win 7 & XP:

require 'watir-webdriver'
default = Watir::WebDriver::Firefox::Profile.new

If you are admin on your machine it will be the following... otherwise search and provide path:

default.add_extension("/Users/Administrator/AppData/Roaming/Mozilla/Firefox/Profiles/krqve9uc.firebug/extensions/[email protected]")
b = Watir::Browser.new(:firefox, :profile => default)