class Unobtainium::Drivers::Appium::DriverProxy
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.
Attributes
appium_driver[R]
selenium_driver[R]
Public Class Methods
new(driver, compatibility = true)
click to toggle source
Initialize
# File lib/unobtainium/drivers/appium.rb, line 36 def initialize(driver, compatibility = true) @appium_driver = driver begin @selenium_driver = driver.start_driver rescue StandardError @selenium_driver = driver.driver end # 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
Public Instance Methods
method_missing(meth, *args, &block)
click to toggle source
Map any missing method to the driver implementation
Calls superclass method
# File lib/unobtainium/drivers/appium.rb, line 69 def method_missing(meth, *args, &block) @drivers.each do |driver| if not driver.nil? and driver.respond_to?(meth) return driver.send(meth, *args, &block) end end return super end
respond_to_missing?(meth, include_private = false)
click to toggle source
Map any missing method to the driver implementation
Calls superclass method
# File lib/unobtainium/drivers/appium.rb, line 58 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