Method: RWebUnit::WebBrowser.attach_browser

Defined in:
lib/rwebunit/web_browser.rb

.attach_browser(how, what, options = {}) ⇒ Object

Attach to existing browser

Usage:

WebBrowser.attach_browser(:title, "iTest2")
WebBrowser.attach_browser(:url, "http://www.itest2.com")
WebBrowser.attach_browser(:url, "http://www.itest2.com", {:browser => "Firefox", :base_url => "http://www.itest2.com"})
WebBrowser.attach_browser(:title, /agileway\.com\.au\/attachment/)  # regular expression


374
375
376
377
378
379
380
381
382
383
# File 'lib/rwebunit/web_browser.rb', line 374

def self.attach_browser(how, what, options={})
  default_options = {:browser => "IE"}
  options = default_options.merge(options)
  site_context = Context.new(options[:base_url]) if options[:base_url]
  if (options[:browser] == "Firefox")
    return WebBrowser.new_from_existing(FireWatir::Firefox.new.attach(how, what), site_context)
  else
    return WebBrowser.new_from_existing(Watir::IE.attach(how, what), site_context)
  end
end