Class: Unobtainium::Drivers::Appium::DriverProxy Private

Inherits:
Object
  • Object
show all
Defined in:
lib/unobtainium/drivers/appium.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Proxy for the actual Appium driver.

There’s an unfortunate disparity of functionality between the Appium::Driver class, and the Selenium::WebDriver class. For maximum compability, we want the latter’s functionality. But for maximum mobile functionality, we want the former.

The DriverProxy class takes this into account when forwarding requests.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(driver, compatibility = true) ⇒ DriverProxy

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/unobtainium/drivers/appium.rb', line 36

def initialize(driver, compatibility = true)
  @appium_driver = driver
  @selenium_driver = driver.start_driver

  # Prioritize the two different drivers according to whether
  # compatibility with Selenium is more desirable than functionality.
  # Note that this only matters when both classes implement the same
  # methods! Differently named methods will always be supported either
  # way.
  if compatibility
    @drivers = [@selenium_driver, @appium_driver]
  else
    @drivers = [@appium_driver, @selenium_driver]
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Map any missing method to the driver implementation



65
66
67
68
69
70
71
72
# File 'lib/unobtainium/drivers/appium.rb', line 65

def method_missing(meth, *args, &block)
  @drivers.each do |driver|
    if not driver.nil? and driver.respond_to?(meth)
      return driver.send(meth.to_s, *args, &block)
    end
  end
  return super
end

Instance Attribute Details

#appium_driverObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
# File 'lib/unobtainium/drivers/appium.rb', line 34

def appium_driver
  @appium_driver
end

#selenium_driverObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
# File 'lib/unobtainium/drivers/appium.rb', line 34

def selenium_driver
  @selenium_driver
end

Instance Method Details

#respond_to_missing?(meth, include_private = false) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Map any missing method to the driver implementation

Returns:

  • (Boolean)


54
55
56
57
58
59
60
61
# File 'lib/unobtainium/drivers/appium.rb', line 54

def respond_to_missing?(meth, include_private = false)
  @drivers.each do |driver|
    if not driver.nil? and driver.respond_to?(meth, include_private)
      return true
    end
  end
  return super
end