Class: Actir::Webdriver::Driver

Inherits:
Object
  • Object
show all
Includes:
Devices, Singleton
Defined in:
lib/actir/webdriver/driver.rb

Instance Method Summary collapse

Methods included from Devices

#agent_string_for, #devices, #resolution_for

Instance Method Details

#for(opts) ⇒ Object



17
18
19
20
21
# File 'lib/actir/webdriver/driver.rb', line 17

def for(opts)
  user_agent_string = agent_string_for opts[:agent]
  options = BrowserOptions.new(opts, user_agent_string)
  build_driver_using options
end

#resize_inner_window(driver, width, height) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/actir/webdriver/driver.rb', line 23

def resize_inner_window(driver, width, height)
  if driver.browser == :firefox or :chrome
    driver.execute_script("window.open(#{driver.current_url.to_json},'_blank');")
    driver.close
    driver.switch_to.window driver.window_handles.first
  end
  driver.execute_script("window.innerWidth = #{width}; window.innerHeight = #{height};")
end