Class: Unobtainium::Drivers::Selenium
- Inherits:
-
Object
- Object
- Unobtainium::Drivers::Selenium
- Defined in:
- lib/unobtainium/drivers/selenium.rb
Overview
Driver implementation wrapping the selenium-webdriver gem.
Constant Summary collapse
- LABELS =
Recognized labels for matching the driver
{ firefox: [:ff,], internet_explorer: [:internetexplorer, :explorer, :ie,], safari: [], chrome: [], chromium: [], }.freeze
Class Method Summary collapse
-
.create(label, _) ⇒ Object
Create and return a driver instance.
-
.ensure_preconditions(_, _) ⇒ Object
Ensure that the driver’s preconditions are fulfilled.
-
.matches?(label) ⇒ Boolean
Return true if the given label matches this driver implementation, false otherwise.
Class Method Details
.create(label, _) ⇒ Object
Create and return a driver instance
44 45 46 47 |
# File 'lib/unobtainium/drivers/selenium.rb', line 44 def create(label, _) driver = ::Selenium::WebDriver.for(normalize_label(label)) return driver end |
.ensure_preconditions(_, _) ⇒ Object
Ensure that the driver’s preconditions are fulfilled.
34 35 36 37 38 39 40 |
# File 'lib/unobtainium/drivers/selenium.rb', line 34 def ensure_preconditions(_, _) require 'selenium-webdriver' rescue LoadError => err raise LoadError, "#{err.}: you need to add "\ "'selenium-webdriver' to your Gemfile to use this driver!", err.backtrace end |
.matches?(label) ⇒ Boolean
Return true if the given label matches this driver implementation, false otherwise.
28 29 30 |
# File 'lib/unobtainium/drivers/selenium.rb', line 28 def matches?(label) return nil != normalize_label(label) end |