Class: OperaBrowser

Inherits:
Browser show all
Defined in:
lib/newjs/jstest.rb

Instance Method Summary collapse

Methods inherited from Browser

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

Constructor Details

#initialize(path = 'c:\Program Files\Opera\Opera.exe') ⇒ OperaBrowser

Returns a new instance of OperaBrowser.



138
139
140
# File 'lib/newjs/jstest.rb', line 138

def initialize(path='c:\Program Files\Opera\Opera.exe')
  @path = path
end

Instance Method Details

#setupObject



142
143
144
145
146
147
148
149
150
151
152
# File 'lib/newjs/jstest.rb', line 142

def setup
  if windows?
    puts %{
      MAJOR ANNOYANCE on Windows.
      You have to shut down Opera manually after each test
      for the script to proceed.
      Any suggestions on fixing this is GREATLY appreciated!
      Thank you for your understanding.
    }
  end
end

#to_sObject



160
161
162
# File 'lib/newjs/jstest.rb', line 160

def to_s
  "Opera"
end

#visit(url) ⇒ Object



154
155
156
157
158
# File 'lib/newjs/jstest.rb', line 154

def visit(url)
  applescript('tell application "Opera" to GetURL "' + url + '"') if macos? 
  system("#{@path} #{url}") if windows? 
  system("opera #{url}")  if linux?
end