Module: Selenium::WebDriver::DriverExtensions::Rotatable

Defined in:
lib/selenium/webdriver/common/driver_extensions/rotatable.rb

Constant Summary collapse

ORIENTATIONS =
[:landscape, :portrait]

Instance Method Summary collapse

Instance Method Details

#orientationObject



21
22
23
# File 'lib/selenium/webdriver/common/driver_extensions/rotatable.rb', line 21

def orientation
  bridge.getScreenOrientation.to_sym.downcase
end

#rotate(orientation) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/selenium/webdriver/common/driver_extensions/rotatable.rb', line 13

def rotate(orientation)
  unless ORIENTATIONS.include?(orientation)
    raise ArgumentError, "expected #{ORIENTATIONS.inspect}, got #{orientation.inspect}"
  end

  bridge.setScreenOrientation(orientation.to_s.upcase)
end