Class: Opera

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

Instance Method Summary collapse

Instance Method Details

#get_binary_pathObject



32
33
34
35
36
37
38
39
40
41
# File 'lib/testnow/opera.rb', line 32

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



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

def launch_driver_opera
  self.opera_config
    @driver = Selenium::WebDriver.for(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
    @driver.manage.timeouts.implicit_wait = 30
    @driver.manage.window.maximize
    @driver.manage.timeouts.page_load = 120
    return @driver
end

#launch_watir_operaObject



22
23
24
25
26
27
28
29
# File 'lib/testnow/opera.rb', line 22

def launch_watir_opera
  self.opera_config
  browser = Watir::Browser.new(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
  browser.driver.manage.timeouts.implicit_wait = 30
    browser.driver.manage.window.maximize
    browser.driver.manage.timeouts.page_load = 120
    return browser
end

#opera_configObject



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

def opera_config
    @client = Selenium::WebDriver::Remote::Http::Default.new
    @client.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