Class: Appium::Core::Base::Bridge::MJSONWP

Inherits:
Selenium::WebDriver::Remote::OSS::Bridge
  • Object
show all
Includes:
Device::AppManagement, Device::AppState, Device::Context, Device::Device, Device::DeviceLock, Device::ExecuteDriver, Device::FileManagement, Device::ImageComparison, Device::ImeActions, Device::KeyEvent, Device::Keyboard, Device::ScreenRecord::Command, Device::Setting, Device::TouchActions, Device::Value
Defined in:
lib/appium_lib_core/common/base/bridge/mjsonwp.rb

Constant Summary

Constants included from Device::AppState

Device::AppState::STATUS

Constants included from Device::ImageComparison

Device::ImageComparison::GET_SIMILARITY, Device::ImageComparison::MATCH_FEATURES, Device::ImageComparison::MATCH_TEMPLATE, Device::ImageComparison::MODE

Instance Method Summary collapse

Methods included from Device::ExecuteDriver

#execute_driver

Methods included from Device::TouchActions

#multi_touch, #touch_actions

Methods included from Device::Device

#device_time, #shake

Methods included from Device::ScreenRecord::Command

#stop_and_save_recording_screen, #stop_recording_screen

Methods included from Device::AppState

#app_state

Methods included from Device::AppManagement

#activate_app, #app_installed?, #app_strings, #background_app, #close_app, #install_app, #launch_app, #remove_app, #reset, #terminate_app

Methods included from Device::ImageComparison

#compare_images, #find_image_occurrence, #get_images_similarity, #match_images_features

Methods included from Device::KeyEvent

#keyevent, #long_press_keycode, #press_keycode

Methods included from Device::FileManagement

#pull_file, #pull_folder, #push_file

Methods included from Device::Value

#replace_value, #set_immediate_value

Methods included from Device::Context

#available_contexts, #current_context, #set_context, #switch_to_default_context, #within_context

Methods included from Device::Setting

#get_settings, #update_settings

Methods included from Device::ImeActions

#ime_activate, #ime_activated, #ime_active_engine, #ime_available_engines, #ime_deactivate

Methods included from Device::Keyboard

#hide_keyboard, #is_keyboard_shown

Methods included from Device::DeviceLock

#device_locked?, #lock, #unlock

Instance Method Details

#commands(command) ⇒ Object


36
37
38
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 36

def commands(command)
  ::Appium::Core::Commands::MJSONWP::COMMANDS[command]
end

#convert_to_element(id) ⇒ ::Selenium::WebDriver::Element

For Appium

Parameters:

  • id (Hash)

    The id which can get as a response from server

Returns:


74
75
76
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 74

def convert_to_element(id)
  ::Selenium::WebDriver::Element.new self, element_id_from(id)
end

#log_event(vendor, event) ⇒ Object

For Appium


46
47
48
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 46

def log_event(vendor, event)
  execute :post_log_event, {}, { vendor: vendor, event: event }
end

#log_events(type = nil) ⇒ Object

For Appium


51
52
53
54
55
56
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 51

def log_events(type = nil)
  args = {}
  args['type'] = type unless type.nil?

  execute :get_log_events, {}, args
end

#send_actions(_data) ⇒ Object


67
68
69
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 67

def send_actions(_data)
  raise Error::UnsupportedOperationError, '#send_actions has not been supported in MJSONWP'
end

#sessionsObject

Returns all available sessions on the Appium server instance


41
42
43
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 41

def sessions
  execute :get_all_sessions
end

#take_element_screenshot(element) ⇒ Object


58
59
60
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 58

def take_element_screenshot(element)
  execute :take_element_screenshot, id: element.ref
end

#take_viewport_screenshotObject


62
63
64
65
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 62

def take_viewport_screenshot
  # TODO: this hasn't been supported by Espresso driver
  execute_script('mobile: viewportScreenshot')
end