Class: Appium::Core::Base::Bridge::MJSONWP
- Inherits:
-
Selenium::WebDriver::Remote::OSS::Bridge
- Object
- Selenium::WebDriver::Remote::OSS::Bridge
- Appium::Core::Base::Bridge::MJSONWP
- 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
Constants included from Device::ImageComparison
Device::ImageComparison::GET_SIMILARITY, Device::ImageComparison::MATCH_FEATURES, Device::ImageComparison::MATCH_TEMPLATE, Device::ImageComparison::MODE
Instance Attribute Summary collapse
-
#available_commands ⇒ Object
readonly
Returns the value of attribute available_commands.
Instance Method Summary collapse
-
#add_command(method:, url:, name:, &block) ⇒ Object
command for Appium 2.0.
- #commands(command) ⇒ Object
-
#convert_to_element(id) ⇒ ::Selenium::WebDriver::Element
For Appium.
-
#initialize(capabilities, session_id, **opts) ⇒ MJSONWP
constructor
A new instance of MJSONWP.
-
#log_event(vendor, event) ⇒ Object
For Appium.
-
#log_events(type = nil) ⇒ Object
For Appium.
- #send_actions(_data) ⇒ Object
-
#sessions ⇒ Object
Returns all available sessions on the Appium server instance.
- #set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil) ⇒ Object
- #status ⇒ Object
- #take_element_screenshot(element) ⇒ Object
- #take_viewport_screenshot ⇒ Object
Methods included from Device::ExecuteDriver
Methods included from Device::TouchActions
Methods included from Device::Device
Methods included from Device::ScreenRecord::Command
#stop_and_save_recording_screen, #stop_recording_screen
Methods included from Device::AppState
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
Constructor Details
#initialize(capabilities, session_id, **opts) ⇒ MJSONWP
38 39 40 41 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 38 def initialize(capabilities, session_id, **opts) @available_commands = ::Appium::Core::Commands::MJSONWP::COMMANDS.dup super(capabilities, session_id, **opts) end |
Instance Attribute Details
#available_commands ⇒ Object (readonly)
Returns the value of attribute available_commands.
36 37 38 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 36 def available_commands @available_commands end |
Instance Method Details
#add_command(method:, url:, name:, &block) ⇒ Object
command for Appium 2.0.
48 49 50 51 52 53 54 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 48 def add_command(method:, url:, name:, &block) raise ::Appium::Core::Error::ArgumentError, "#{name} is already defined" if @available_commands.key? name @available_commands[name] = [method, url] ::Appium::Core::Device.add_endpoint_method name, &block end |
#commands(command) ⇒ Object
43 44 45 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 43 def commands(command) @available_commands[command] end |
#convert_to_element(id) ⇒ ::Selenium::WebDriver::Element
For Appium
94 95 96 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 94 def convert_to_element(id) ::Selenium::WebDriver::Element.new self, element_id_from(id) end |
#log_event(vendor, event) ⇒ Object
For Appium
66 67 68 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 66 def log_event(vendor, event) execute :post_log_event, {}, { vendor: vendor, event: event } end |
#log_events(type = nil) ⇒ Object
For Appium
71 72 73 74 75 76 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 71 def log_events(type = nil) args = {} args['type'] = type unless type.nil? execute :get_log_events, {}, args end |
#send_actions(_data) ⇒ Object
87 88 89 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 87 def send_actions(_data) raise Error::UnsupportedOperationError, '#send_actions has not been supported in MJSONWP' end |
#sessions ⇒ Object
Returns all available sessions on the Appium server instance
57 58 59 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 57 def sessions execute :get_all_sessions end |
#set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil) ⇒ Object
98 99 100 101 102 103 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 98 def set_location(lat, lon, alt = 0.0, speed: nil, satellites: nil) loc = { latitude: lat, longitude: lon, altitude: alt } loc[:speed] = speed unless speed.nil? loc[:satellites] = satellites unless satellites.nil? execute :set_location, {}, { location: loc } end |
#status ⇒ Object
61 62 63 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 61 def status execute :status end |
#take_element_screenshot(element) ⇒ Object
78 79 80 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 78 def take_element_screenshot(element) execute :take_element_screenshot, id: element.ref end |
#take_viewport_screenshot ⇒ Object
82 83 84 85 |
# File 'lib/appium_lib_core/common/base/bridge/mjsonwp.rb', line 82 def # TODO: this hasn't been supported by Espresso driver execute_script('mobile: viewportScreenshot') end |