Tag: httpwatch

如何通过watir-webdriver获取IE的WIN32OLE句柄?

在Watir中,您可以使用下一个方法获取IE窗口的WIN32OLE句柄。 irb(main):059:0> browser.ie => # 我需要以某种方式获得由watir-webdriver创建的IE的相同返回。 有办法吗? 或者至少有人能指出我挖掘的方向。 我需要这些东西将HTTPwatch插件附加到我的浏览器实例。 以下是HTTPWatch代码的示例。 require ‘watir’ require ‘win32ole’ browser = Watir::Browser.new controller = WIN32OLE.new(‘HttpWatch.Controller’) plugin = controller.IE.Attach(browser.ie) UPD:感谢Justin Ko我有工作代码 require ‘win32ole’ require ‘watir-webdriver’ browser = Watir::Browser.new :ie title = browser.title browser.goto “google.com” length = WIN32OLE.new(‘Shell.Application’).Windows.count – 1 (0..length).each do |i| begin WIN32OLE.new(‘Shell.Application’).Windows(i).Document.Title $ie = WIN32OLE.new(‘Shell.Application’).Windows(i) rescue end end controller […]