Class: Chrome

Inherits:
Browser show all
Defined in:
lib/hanoi/browsers/chrome.rb

Instance Method Summary collapse

Methods inherited from Browser

#escaped_name, #host, #linux?, #macos?, #path, #runnable?, #setup, #teardown, #to_s, #visit, #windows?

Constructor Details

#initialize(path = nil) ⇒ Chrome

Returns a new instance of Chrome.



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/hanoi/browsers/chrome.rb', line 2

def initialize(path = nil)
  @path = path || File.join(
    ENV['UserPath'] || ENV['UserProfile'] || "C:/Documents and Settings/Administrator",
    "AppData",
    "Local",
    "Google",
    "Chrome",
    "Application",
    "chrome.exe"
  )
end

Instance Method Details

#installed?Boolean

Returns:

  • (Boolean)


18
19
20
21
22
23
24
# File 'lib/hanoi/browsers/chrome.rb', line 18

def installed?
  if macos?
    File.exist?("/Applications/#{name}.app")
  else
    super
  end
end

#nameObject



26
27
28
# File 'lib/hanoi/browsers/chrome.rb', line 26

def name
  "Google Chrome"
end

#supported?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/hanoi/browsers/chrome.rb', line 14

def supported?
  windows? || macos?
end