Class: AdminModule::Pages::BrowserInst
- Inherits:
-
Object
- Object
- AdminModule::Pages::BrowserInst
- Defined in:
- lib/admin_module/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.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/admin_module/pages.rb', line 54 def self.browser if ! open_browser? BrowserLoader::Factory.browser_timeout = AdminModule.configuration.browser_timeout BrowserLoader::Factory.download_dir = AdminModule.configuration.download_dir unless AdminModule.configuration.download_dir.empty? @@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
72 73 74 |
# File 'lib/admin_module/pages.rb', line 72 def self.open_browser? return (! @@browser.nil? && @@browser.exist? ) end |