Class: Hollandaise::Browser::Base
- Inherits:
-
Object
- Object
- Hollandaise::Browser::Base
- Defined in:
- lib/hollandaise/browser/base.rb
Instance Attribute Summary collapse
-
#browser ⇒ Object
readonly
Returns the value of attribute browser.
Instance Method Summary collapse
- #close ⇒ Object
- #dir ⇒ Object
- #run_and_take_screenshot(url, screen_size = [ 1280, 1024 ]) ⇒ Object
- #take_screenshot ⇒ Object
Instance Attribute Details
#browser ⇒ Object (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
#close ⇒ Object
21 22 23 24 25 |
# File 'lib/hollandaise/browser/base.rb', line 21 def close selenium.quit @selenium = nil end |
#dir ⇒ Object
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_screenshot ⇒ Object
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 |