Method: Appium::Core::Base::Driver#key_action

Defined in:
lib/appium_lib_core/common/base/driver.rb

#key_action(async: false) ⇒ Object

Perform ‘key’ actions for W3C module. Generate key pointer action here and users can use this via driver.key_action

The pointer type is ‘key’ by default in the Appium Ruby client. driver.action in Appium Ruby client has ‘pointer’ action by default. This method is a shortcut to set ‘key’ type. Hense this method is equal to driver.action(devices: [::Selenium::WebDriver::Interactions.key(‘keyboard’)]) as below example.

Examples:


element = @driver.find_element(:id, "some id")
@driver.key_action.send_key('hiあ').perform # The 'send_key' is a part of 'KeyActions'
# is equal to:
# @driver.action(devices: [::Selenium::WebDriver::Interactions.key('keyboard')]).send_keys('hiあ').perform


216
217
218
219
220
221
# File 'lib/appium_lib_core/common/base/driver.rb', line 216

def key_action(async: false)
  @bridge.action(
    async: async,
    devices: [::Selenium::WebDriver::Interactions.key('keyboard')]
  )
end