Class: AmsLayout::Pages::BrowserInst
- Inherits:
-
Object
- Object
- AmsLayout::Pages::BrowserInst
- Defined in:
- lib/ams_layout/pages.rb
Constant Summary collapse
- @@browser =
nil
Class Method Summary collapse
-
.browser ⇒ Object
Return a configured browser object.
- .open_browser? ⇒ Boolean
Class Method Details
.browser ⇒ Object
Return a configured browser object. If a browser has already been created, this returns the existing browser.
An at_exit proc is created to close the browser when the program exits.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/ams_layout/pages.rb', line 25 def self.browser if ! open_browser? BrowserLoader::Factory.browser_timeout = AmsLayout.configuration.browser_timeout @@browser = BrowserLoader::Factory.build at_exit do unless ! open_browser? # Make sure every webdriver window is closed. @@browser.windows.each { |w| w.close rescue nil } @@browser.close rescue nil end end end @@browser end |
.open_browser? ⇒ Boolean
42 43 44 |
# File 'lib/ams_layout/pages.rb', line 42 def self.open_browser? return (! @@browser.nil? && @@browser.exist? ) end |