class Girbot::BrowserHolder

Attributes

browser[RW]
proxy[RW]
which[RW]

Public Class Methods

new(which='firefox', proxy=nil) click to toggle source
# File lib/girbot/browser_holder.rb, line 5
def initialize which='firefox', proxy=nil
  @which = which
  @proxy = proxy
end

Public Instance Methods

chrome() click to toggle source
# File lib/girbot/browser_holder.rb, line 28
def chrome
  Watir::Browser.new :chrome
end
chrome_proxy(proxy) click to toggle source
# File lib/girbot/browser_holder.rb, line 32
def chrome_proxy proxy
  switches = "--proxy-server=#{proxy}"
  Watir::Browser.new :chrome, :switches => switches
end
firefox() click to toggle source
# File lib/girbot/browser_holder.rb, line 18
def firefox
  Watir::Browser.new :firefox
end
firefox_proxy(proxy) click to toggle source
# File lib/girbot/browser_holder.rb, line 22
def firefox_proxy proxy
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile.proxy = Selenium::WebDriver::Proxy.new :http => proxy, :ssl => proxy
  Watir::Browser.new :firefox, :profile => profile
end
init() click to toggle source
# File lib/girbot/browser_holder.rb, line 10
def init
  if @proxy.nil?
    @browser = send(@which)
  else
    @browser = send("#{@which}_proxy", @proxy)
  end
end