Module: Appium::Core::Base::Rotatable Private

Included in:
Driver
Defined in:
lib/appium_lib_core/common/base/rotable.rb

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Constant Summary collapse

ORIENTATIONS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%i[
  landscape
  portrait
  uia_device_orientation_landscaperight
  uia_device_orientation_portrait_upsidedown
].freeze

Instance Method Summary collapse

Instance Method Details

#orientation:landscape, ...

Get the current screen orientation

Returns:

  • (:landscape, :portrait, :uia_device_orientation_landscaperight, :uia_device_orientation_portrait_upsidedown)

    orientation



56
57
58
# File 'lib/appium_lib_core/common/base/rotable.rb', line 56

def orientation
  bridge.screen_orientation.to_sym.downcase
end

#rotation=(orientation) ⇒ Object Also known as: rotate, orientation=

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Change the screen orientation

Parameters:

  • orientation (:landscape, :portrait, :uia_device_orientation_landscaperight, :uia_device_orientation_portrait_upsidedown)


37
38
39
40
41
42
43
# File 'lib/appium_lib_core/common/base/rotable.rb', line 37

def rotation=(orientation)
  unless ORIENTATIONS.include?(orientation)
    raise ::Appium::Core::Error::ArgumentError, "expected #{ORIENTATIONS.inspect}, got #{orientation.inspect}"
  end

  bridge.screen_orientation = orientation.to_s.upcase
end