Module: Appium::Core::Android::Device::Screen

Includes:
_Bridge
Defined in:
lib/appium_lib_core/android/device/screen.rb,
sig/lib/appium_lib_core/android/device/screen.rbs

Class Method Summary collapse

Methods included from _Bridge

#bridge, #execute, #execute_async_script, #execute_script

Class Method Details

.add_methodsObject

Returns:

  • (Object)


20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/appium_lib_core/android/device/screen.rb', line 20

def self.add_methods
  ::Appium::Core::Device.add_endpoint_method(:get_display_density) do
    def get_display_density
      execute_script 'mobile:getDisplayDensity', {}
    end
  end

  ::Appium::Core::Device.add_endpoint_method(:start_recording_screen) do
    def start_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT',
                               file_field_name: nil, form_fields: nil, headers: nil, force_restart: nil,
                               video_size: nil, time_limit: '180', bit_rate: nil, bug_report: nil)
      option = ::Appium::Core::Base::Device::ScreenRecord.new(
        remote_path: remote_path, user: user, pass: pass, method: method,
        file_field_name: file_field_name, form_fields: form_fields, headers: headers,
        force_restart: force_restart
      ).upload_option

      option[:videoSize] = video_size unless video_size.nil?
      option[:timeLimit] = time_limit
      option[:bitRate] = bit_rate unless bit_rate.nil?

      unless bug_report.nil?
        raise ::Appium::Core::Error::ArgumentError, 'bug_report should be true or false' unless [true, false].member?(bug_report)

        option[:bugReport] = bug_report
      end

      execute(:start_recording_screen, {}, { options: option })
    end
  end
end