开发者

Can Watir interact with Firefox Extensions?

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 a开发者_高级运维lready 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


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/


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/firebug@software.joehewitt.com.xpi")
b = Watir::Browser.new(:firefox, :profile => default)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜