Class: Popart::Browser
- Inherits:
-
Object
- Object
- Popart::Browser
- Defined in:
- lib/popart/browser.rb
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
Instance Method Summary collapse
- #cleanup ⇒ Object
- #filename ⇒ Object
-
#initialize(capabilities) ⇒ Browser
constructor
A new instance of Browser.
- #perform(&block) ⇒ Object
Constructor Details
#initialize(capabilities) ⇒ Browser
Returns a new instance of Browser.
7 8 9 |
# File 'lib/popart/browser.rb', line 7 def initialize capabilities @capabilities = capabilities end |
Instance Attribute Details
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
5 6 7 |
# File 'lib/popart/browser.rb', line 5 def capabilities @capabilities end |
Instance Method Details
#cleanup ⇒ Object
31 32 33 34 35 36 |
# File 'lib/popart/browser.rb', line 31 def cleanup @browser.quit if @browser rescue ensure @browser = nil end |
#filename ⇒ Object
24 25 26 27 28 29 |
# File 'lib/popart/browser.rb', line 24 def filename filename = capabilities["browserName"] + '_' + capabilities["version"] + '_' + capabilities["platform"] + '.png' filename.gsub! " ", "-" filename end |
#perform(&block) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/popart/browser.rb', line 11 def perform &block unless @browser @browser = SeleniumSession.new capabilities begin yield @browser rescue # TODO SOMETHING LESS CRAP HERE end end end |