Class: Opera

Inherits:
Object
  • Object
show all
Defined in:
lib/testnow/opera.rb

Instance Method Summary collapse

Instance Method Details

#get_binary_pathObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/testnow/opera.rb', line 36

def get_binary_path
  case RUBY_PLATFORM
    when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
      return "NEED TO FIND WINDOWS BINARY LOCATION"
    when /darwin|mac os/
      return "/Applications/Opera.app/Contents/MacOS/Opera"
    else
      return "/usr/bin/opera"
  end
end

#launch_driver_operaObject

Opera browser



20
21
22
23
24
25
# File 'lib/testnow/opera.rb', line 20

def launch_driver_opera
  self.pre_config
  driver = Selenium::WebDriver.for(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
  self.post_config(driver)
  return driver
end

#launch_watir_operaObject

Opera browser



28
29
30
31
32
33
# File 'lib/testnow/opera.rb', line 28

def launch_watir_opera
  self.pre_config
  browser = Watir::Browser.new(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
  self.post_config(browser.driver)
  return browser
end

#post_config(driver) ⇒ Object



13
14
15
16
17
# File 'lib/testnow/opera.rb', line 13

def post_config(driver)
  driver.manage.timeouts.implicit_wait = 30
  driver.manage.window.maximize
  driver.manage.timeouts.page_load = 120
end

#pre_configObject



4
5
6
7
8
9
10
# File 'lib/testnow/opera.rb', line 4

def pre_config
  @client = Selenium::WebDriver::Remote::Http::Default.new
  @client.read_timeout = 180 # seconds
  @service = Selenium::WebDriver::Chrome::Service.new("/usr/local/bin/operadriver", 48923, {})
  @service.start
  @cap = Selenium::WebDriver::Remote::Capabilities.chrome('operaOptions' => {'binary' => "#{get_binary_path}", 'args' => ["--ignore-certificate-errors"]})
end