Class: Unobtainium::Driver
- Inherits:
-
Object
- Object
- Unobtainium::Driver
- Defined in:
- lib/unobtainium/driver.rb
Overview
Creating a Driver instance creates either an Appium or Selenium driver depending on the arguments, and delegates all else to the underlying implementation.
It’s possible to add more drivers, but Appium and Selenium are the main targets.
Instance Attribute Summary collapse
-
#impl ⇒ Object
readonly
Public methods.
-
#label ⇒ Object
readonly
Public methods.
-
#options ⇒ Object
readonly
Public methods.
Class Method Summary collapse
-
.create(*args) ⇒ Object
Create a driver instance with the given arguments.
Instance Method Summary collapse
-
#initialize(*args) ⇒ Driver
constructor
Initializer.
Constructor Details
#initialize(*args) ⇒ Driver
Initializer
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/unobtainium/driver.rb', line 36 def initialize(*args) # Sanitize options @label, @options = (*args) # Load drivers load_drivers # Determine the driver class, if any driver_klass = get_driver(@label) if not driver_klass raise LoadError, "No driver implementation matching #{@label} found, "\ "aborting!" end # Perform precondition checks of the driver class driver_klass.ensure_preconditions(@label, @options) # Great, instanciate! @impl = driver_klass.create(@label, @options) end |
Instance Attribute Details
#impl ⇒ Object (readonly)
Public methods
32 33 34 |
# File 'lib/unobtainium/driver.rb', line 32 def impl @impl end |
#label ⇒ Object (readonly)
Public methods
32 33 34 |
# File 'lib/unobtainium/driver.rb', line 32 def label @label end |
#options ⇒ Object (readonly)
Public methods
32 33 34 |
# File 'lib/unobtainium/driver.rb', line 32 def @options end |