Module: Appium::Core::Device

Extended by:
Forwardable
Defined in:
lib/appium_lib_core/device.rb

Class Method Summary collapse

Class Method Details

.add_endpoint_method(method, &block) ⇒ Object

Define method in Bridges



49
50
51
52
53
54
# File 'lib/appium_lib_core/device.rb', line 49

def add_endpoint_method(method, &block)
  block_given? ? create_bridge_command(method, &block) : create_bridge_command(method)

  delegate_driver_method method
  delegate_from_appium_driver method
end

.extend_webdriver_with_forwardableObject



57
58
59
60
61
62
63
# File 'lib/appium_lib_core/device.rb', line 57

def extend_webdriver_with_forwardable
  return if ::Appium::Core::Base::Driver.is_a? Forwardable

  ::Appium::Core::Base::Driver.class_eval do
    extend Forwardable
  end
end

.extended(_mod) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/appium_lib_core/device.rb', line 21

def extended(_mod)
  extend_webdriver_with_forwardable

  # Compatibility for appium_lib. Below command are extended by `extend Appium::Core::Deivce`in appium_lib.
  # TODO: Will remove
  [
    :take_element_screenshot, :save_viewport_screenshot,
    :lock, :device_locked?, :unlock,
    :hide_keyboard, :is_keyboard_shown,
    :ime_activate, :ime_available_engines, :ime_active_engine, :ime_activated, :ime_deactivate,
    :get_settings, :update_settings,
    :within_context, :current_context, :available_contexts, :set_context,
    :push_file, :pull_file, :pull_folder,
    :keyevent, :press_keycode, :long_press_keycode,
    :match_images_features, :find_image_occurrence, :get_images_similarity, :compare_images,
    :app_strings, :background_app,
    :install_app, :remove_app, :app_installed?, :activate_app, :terminate_app,
    :app_state,
    :stop_recording_screen, :stop_and_save_recording_screen,
    :shake, :device_time,
    :execute_driver, :execute_cdp
  ].each(&method(:delegate_from_appium_driver))
end