Module: Watirloo

Defined in:
lib/watirloo.rb,
lib/watirloo/page.rb,
lib/watirloo/locker.rb,
lib/watirloo/desktop.rb,
lib/watirloo/browsers.rb,
lib/watirloo/screenshot.rb

Defined Under Namespace

Modules: Browsers, Desktop, Locker, Page, ScreenCapture Classes: FireLocker

Constant Summary collapse

VERSION =
File.exist?('VERSION') ? (File.read('VERSION')).strip : "VERSION undefined"

Class Method Summary collapse

Class Method Details

.browser(key = 'default') ⇒ Object

This is ‘opinionated’ method. The way I work with browsers is this: I save the current handle of the browser (ie.hwnd) to the storage yaml file so I can reattach to the same browser later. Basically in exploratory testing I don’t want to start and close browsers. I want to maintain reference to one (or more) browsers and I have nicknames for them. on restart of tests useing Watirloo I reuse the browser. If the browser is not there I just start a new browser which will from now on become my new ‘default’ test session browser. In Case of Firefox I attach to the ‘one’ existing firefox or a start a new one. So this method either attaches to one that’s there or it starts a new one and puts it in Browsers::Storage this way of working with browsers is opinionated I think. if you want you can just use Watir::IE.start and reuse that browsers for tests. This here is a convenience method



14
15
16
17
18
19
# File 'lib/watirloo/browsers.rb', line 14

def self.browser(key = 'default')
  case Browsers.target
  when :ie then Browsers.ie key
  when :firefox then Browsers.ff
  end
end