Class: FirefoxBrowser

Inherits:
Browser show all
Defined in:
lib/test/browser.rb

Instance Method Summary collapse

Methods inherited from Browser

#applescript, #host, #linux?, #macos?, #open, #setup, #supported?, #teardown, #windows?

Constructor Details

#initialize(path = File.join(ENV['ProgramFiles'] || 'c:\Program Files', '\Mozilla Firefox\firefox.exe')) ⇒ FirefoxBrowser

Returns a new instance of FirefoxBrowser.



31
32
33
# File 'lib/test/browser.rb', line 31

def initialize(path=File.join(ENV['ProgramFiles'] || 'c:\Program Files', '\Mozilla Firefox\firefox.exe'))
  @path = path
end

Instance Method Details

#to_sObject



41
42
43
# File 'lib/test/browser.rb', line 41

def to_s
  "Firefox"
end

#visit(url) ⇒ Object



35
36
37
38
39
# File 'lib/test/browser.rb', line 35

def visit(url)
  system("open -a \"Firefox.app\" '#{url}'") if macos?
  system("#{@path} #{url}") if windows? 
  system("firefox #{url}") if linux?
end