Class: Hollandaise::Browser::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hollandaise/browser/base.rb

Direct Known Subclasses

Sauce, Selenium

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#browserObject (readonly)

Returns the value of attribute browser.



4
5
6
# File 'lib/hollandaise/browser/base.rb', line 4

def browser
  @browser
end

Instance Method Details

#closeObject



21
22
23
24
25
# File 'lib/hollandaise/browser/base.rb', line 21

def close
  selenium.quit

  @selenium = nil
end

#dirObject



27
28
29
# File 'lib/hollandaise/browser/base.rb', line 27

def dir
  Hollandaise.dir
end

#run_and_take_screenshot(url, screen_size = [ 1280, 1024 ]) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/hollandaise/browser/base.rb', line 6

def run_and_take_screenshot(url, screen_size = [ 1280, 1024 ])
  @url = url

  selenium.navigate.to url
  sleep @options[:delay].to_i
  selenium.manage.window.resize_to(*screen_size)
  take_screenshot
end

#take_screenshotObject



15
16
17
18
19
# File 'lib/hollandaise/browser/base.rb', line 15

def take_screenshot
  target.parent.mkpath

  selenium.save_screenshot(target.to_s)
end