Module: Appium::Android::Command

Defined in:
lib/appium_lib/android/common/command/command.rb

Instance Method Summary collapse

Instance Method Details

#shell(command, arguments) ⇒ Object

Conduct an adb shell script on Appium server. Require --relaxed-security arguments when run Appium server as server side arguments.

Examples:


shell "echo", "list" #=> "list"

Parameters:

  • command (String)

    Command for “adb shell”

  • arguments (Array)

    Arguments for the adb command



28
29
30
31
32
# File 'lib/appium_lib/android/common/command/command.rb', line 28

def shell(command, arguments)
  args = { command: command, args: arguments }
  # --relaxed-security
  @driver.execute_script 'mobile: shell', args
end

#start_logs_broadcast(logcat_file = 'logcat.log') ⇒ Object

Deprecated.

Please use BiDi implementation via ‘$driver.driver.bidi` directly instead.

Starts Android logcat broadcast websocket

Examples:


start_logs_broadcast 'outputfile.log' #=> #<Appium::Android::Command::WsLogcat:...>

Parameters:

  • logcat_file (String) (defaults to: 'logcat.log')

    A file path to write messages from a logcat WebSocket client



44
45
46
47
48
49
# File 'lib/appium_lib/android/common/command/command.rb', line 44

def start_logs_broadcast(logcat_file = 'logcat.log')
  @driver.execute_script 'mobile: startLogsBroadcast'

  socket_url = "ws://#{URI.parse(server_url).host}:#{@core.port}/ws/session/#{@driver.session_id}/appium/device/logcat"
  @logcat_client = ::Appium::Common::Command::WsLogcat.new(url: socket_url, output_file: logcat_file)
end

#stop_logs_broadcastObject

Deprecated.

Please use BiDi implementation directly instead.

Stop Android logcat broadcast websocket

Examples:


stop_logs_broadcast #=> nil


59
60
61
62
63
# File 'lib/appium_lib/android/common/command/command.rb', line 59

def stop_logs_broadcast
  @logcat_client.close

  @driver.execute_script 'mobile: stopLogsBroadcast'
end