Class: Playwright::Android

Inherits:
PlaywrightApi show all
Defined in:
lib/playwright_api/android.rb

Overview

Playwright has experimental support for Android automation. This includes Chrome for Android and Android WebView.

Requirements

*Known limitations*

  • Raw USB operation is not yet supported, so you need ADB.

  • Device needs to be awake to produce screenshots. Enabling “Stay awake” developer mode will help.

  • We didn’t run all the tests against the device, so not everything works.

*How to run*

An example of the Android automation script would be:

Instance Method Summary collapse

Methods inherited from PlaywrightApi

#initialize, unwrap, wrap

Constructor Details

This class inherits a constructor from Playwright::PlaywrightApi

Instance Method Details

#connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil) ⇒ Object

This methods attaches Playwright to an existing Android device. Use [‘method: Android.launchServer`] to launch a new Android server instance.

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/playwright_api/android.rb', line 24

def connect(wsEndpoint, headers: nil, slowMo: nil, timeout: nil)
  raise NotImplementedError.new('connect is not implemented yet.')
end

#devices(host: nil, omitDriverInstall: nil, port: nil) ⇒ Object

Returns the list of detected Android devices.



30
31
32
# File 'lib/playwright_api/android.rb', line 30

def devices(host: nil, omitDriverInstall: nil, port: nil)
  wrap_impl(@impl.devices(host: unwrap_impl(host), omitDriverInstall: unwrap_impl(omitDriverInstall), port: unwrap_impl(port)))
end

#off(event, callback) ⇒ Object

– inherited from EventEmitter –



55
56
57
# File 'lib/playwright_api/android.rb', line 55

def off(event, callback)
  event_emitter_proxy.off(event, callback)
end

#on(event, callback) ⇒ Object

– inherited from EventEmitter –



49
50
51
# File 'lib/playwright_api/android.rb', line 49

def on(event, callback)
  event_emitter_proxy.on(event, callback)
end

#once(event, callback) ⇒ Object

– inherited from EventEmitter –



43
44
45
# File 'lib/playwright_api/android.rb', line 43

def once(event, callback)
  event_emitter_proxy.once(event, callback)
end

#set_default_timeout(timeout) ⇒ Object Also known as: default_timeout=

This setting will change the default maximum time for all the methods accepting ‘timeout` option.

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/playwright_api/android.rb', line 36

def set_default_timeout(timeout)
  raise NotImplementedError.new('set_default_timeout is not implemented yet.')
end