Class: Playwright::AndroidDevice
- Inherits:
-
PlaywrightApi
- Object
- PlaywrightApi
- Playwright::AndroidDevice
- Defined in:
- lib/playwright_api/android_device.rb
Overview
‘AndroidDevice` represents a connected device, either real hardware or emulated. Devices can be obtained using [`method: Android.devices`].
Instance Method Summary collapse
-
#close ⇒ Object
Disconnects from the device.
-
#drag(selector, dest, speed: nil) ⇒ Object
Drags the widget defined by ‘selector` towards `dest` point.
-
#fill(selector, text) ⇒ Object
Fills the specific ‘selector` input box with `text`.
-
#fling(selector, direction, speed: nil) ⇒ Object
Flings the widget defined by ‘selector` in the specified `direction`.
-
#info(selector) ⇒ Object
Returns information about a widget defined by ‘selector`.
-
#input ⇒ Object
property.
-
#install_apk(file, args: nil) ⇒ Object
Installs an apk on the device.
-
#launch_browser(acceptDownloads: nil, args: nil, baseURL: nil, bypassCSP: nil, colorScheme: nil, command: nil, deviceScaleFactor: nil, extraHTTPHeaders: nil, forcedColors: nil, geolocation: nil, hasTouch: nil, httpCredentials: nil, ignoreHTTPSErrors: nil, isMobile: nil, javaScriptEnabled: nil, locale: nil, noViewport: nil, offline: nil, permissions: nil, proxy: nil, record_har_content: nil, record_har_mode: nil, record_har_omit_content: nil, record_har_path: nil, record_har_url_filter: nil, record_video_dir: nil, record_video_size: nil, reducedMotion: nil, screen: nil, serviceWorkers: nil, strictSelectors: nil, timezoneId: nil, userAgent: nil, viewport: nil, &block) ⇒ Object
Launches Chrome browser on the device, and returns its persistent context.
-
#long_tap(selector) ⇒ Object
Performs a long tap on the widget defined by ‘selector`.
-
#model ⇒ Object
Device model.
-
#off(event, callback) ⇒ Object
– inherited from EventEmitter –.
-
#on(event, callback) ⇒ Object
– inherited from EventEmitter –.
-
#once(event, callback) ⇒ Object
– inherited from EventEmitter –.
-
#open(command) ⇒ Object
Launches a process in the shell on the device and returns a socket to communicate with the launched process.
-
#pinch_close(selector, percent, speed: nil) ⇒ Object
Pinches the widget defined by ‘selector` in the closing direction.
-
#pinch_open(selector, percent, speed: nil) ⇒ Object
Pinches the widget defined by ‘selector` in the open direction.
-
#press(selector, key) ⇒ Object
Presses the specific ‘key` in the widget defined by `selector`.
-
#push(file, path, mode: nil) ⇒ Object
Copies a file to the device.
-
#screenshot(path: nil) ⇒ Object
Returns the buffer with the captured screenshot of the device.
-
#scroll(selector, direction, percent, speed: nil) ⇒ Object
Scrolls the widget defined by ‘selector` in the specified `direction`.
-
#serial ⇒ Object
Device serial number.
-
#set_default_timeout(timeout) ⇒ Object
(also: #default_timeout=)
This setting will change the default maximum time for all the methods accepting ‘timeout` option.
-
#shell(command) ⇒ Object
Executes a shell command on the device and returns its output.
- #should_close_connection_on_close! ⇒ Object
-
#swipe(selector, direction, percent, speed: nil) ⇒ Object
Swipes the widget defined by ‘selector` in the specified `direction`.
- #tap_on(selector, duration: nil, timeout: nil) ⇒ Object
-
#tap_point(selector, duration: nil) ⇒ Object
Taps on the widget defined by ‘selector`.
-
#wait(selector, state: nil) ⇒ Object
Waits for the specific ‘selector` to either appear or disappear, depending on the `state`.
-
#wait_for_event(event, optionsOrPredicate: nil) ⇒ Object
Waits for event to fire and passes its value into the predicate function.
-
#web_view(selector) ⇒ Object
This method waits until ‘AndroidWebView` matching the `selector` is opened and returns it.
-
#web_views ⇒ Object
Currently open WebViews.
Methods inherited from PlaywrightApi
Constructor Details
This class inherits a constructor from Playwright::PlaywrightApi
Instance Method Details
#close ⇒ Object
Disconnects from the device.
12 13 14 |
# File 'lib/playwright_api/android_device.rb', line 12 def close wrap_impl(@impl.close) end |
#drag(selector, dest, speed: nil) ⇒ Object
Drags the widget defined by ‘selector` towards `dest` point.
18 19 20 |
# File 'lib/playwright_api/android_device.rb', line 18 def drag(selector, dest, speed: nil) raise NotImplementedError.new('drag is not implemented yet.') end |
#fill(selector, text) ⇒ Object
Fills the specific ‘selector` input box with `text`.
24 25 26 |
# File 'lib/playwright_api/android_device.rb', line 24 def fill(selector, text) raise NotImplementedError.new('fill is not implemented yet.') end |
#fling(selector, direction, speed: nil) ⇒ Object
Flings the widget defined by ‘selector` in the specified `direction`.
30 31 32 |
# File 'lib/playwright_api/android_device.rb', line 30 def fling(selector, direction, speed: nil) raise NotImplementedError.new('fling is not implemented yet.') end |
#info(selector) ⇒ Object
Returns information about a widget defined by ‘selector`.
36 37 38 |
# File 'lib/playwright_api/android_device.rb', line 36 def info(selector) wrap_impl(@impl.info(unwrap_impl(selector))) end |
#input ⇒ Object
property
6 7 8 |
# File 'lib/playwright_api/android_device.rb', line 6 def input # property wrap_impl(@impl.input) end |
#install_apk(file, args: nil) ⇒ Object
Installs an apk on the device.
42 43 44 |
# File 'lib/playwright_api/android_device.rb', line 42 def install_apk(file, args: nil) raise NotImplementedError.new('install_apk is not implemented yet.') end |
#launch_browser(acceptDownloads: nil, args: nil, baseURL: nil, bypassCSP: nil, colorScheme: nil, command: nil, deviceScaleFactor: nil, extraHTTPHeaders: nil, forcedColors: nil, geolocation: nil, hasTouch: nil, httpCredentials: nil, ignoreHTTPSErrors: nil, isMobile: nil, javaScriptEnabled: nil, locale: nil, noViewport: nil, offline: nil, permissions: nil, proxy: nil, record_har_content: nil, record_har_mode: nil, record_har_omit_content: nil, record_har_path: nil, record_har_url_filter: nil, record_video_dir: nil, record_video_size: nil, reducedMotion: nil, screen: nil, serviceWorkers: nil, strictSelectors: nil, timezoneId: nil, userAgent: nil, viewport: nil, &block) ⇒ Object
Launches Chrome browser on the device, and returns its persistent context.
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/playwright_api/android_device.rb', line 48 def launch_browser( acceptDownloads: nil, args: nil, baseURL: nil, bypassCSP: nil, colorScheme: nil, command: nil, deviceScaleFactor: nil, extraHTTPHeaders: nil, forcedColors: nil, geolocation: nil, hasTouch: nil, httpCredentials: nil, ignoreHTTPSErrors: nil, isMobile: nil, javaScriptEnabled: nil, locale: nil, noViewport: nil, offline: nil, permissions: nil, proxy: nil, record_har_content: nil, record_har_mode: nil, record_har_omit_content: nil, record_har_path: nil, record_har_url_filter: nil, record_video_dir: nil, record_video_size: nil, reducedMotion: nil, screen: nil, serviceWorkers: nil, strictSelectors: nil, timezoneId: nil, userAgent: nil, viewport: nil, &block) wrap_impl(@impl.launch_browser(acceptDownloads: unwrap_impl(acceptDownloads), args: unwrap_impl(args), baseURL: unwrap_impl(baseURL), bypassCSP: unwrap_impl(bypassCSP), colorScheme: unwrap_impl(colorScheme), command: unwrap_impl(command), deviceScaleFactor: unwrap_impl(deviceScaleFactor), extraHTTPHeaders: unwrap_impl(extraHTTPHeaders), forcedColors: unwrap_impl(forcedColors), geolocation: unwrap_impl(geolocation), hasTouch: unwrap_impl(hasTouch), httpCredentials: unwrap_impl(httpCredentials), ignoreHTTPSErrors: unwrap_impl(ignoreHTTPSErrors), isMobile: unwrap_impl(isMobile), javaScriptEnabled: unwrap_impl(javaScriptEnabled), locale: unwrap_impl(locale), noViewport: unwrap_impl(noViewport), offline: unwrap_impl(offline), permissions: unwrap_impl(), proxy: unwrap_impl(proxy), record_har_content: unwrap_impl(record_har_content), record_har_mode: unwrap_impl(record_har_mode), record_har_omit_content: unwrap_impl(record_har_omit_content), record_har_path: unwrap_impl(record_har_path), record_har_url_filter: unwrap_impl(record_har_url_filter), record_video_dir: unwrap_impl(record_video_dir), record_video_size: unwrap_impl(record_video_size), reducedMotion: unwrap_impl(reducedMotion), screen: unwrap_impl(screen), serviceWorkers: unwrap_impl(serviceWorkers), strictSelectors: unwrap_impl(strictSelectors), timezoneId: unwrap_impl(timezoneId), userAgent: unwrap_impl(userAgent), viewport: unwrap_impl(), &wrap_block_call(block))) end |
#long_tap(selector) ⇒ Object
Performs a long tap on the widget defined by ‘selector`.
89 90 91 |
# File 'lib/playwright_api/android_device.rb', line 89 def long_tap(selector) raise NotImplementedError.new('long_tap is not implemented yet.') end |
#model ⇒ Object
Device model.
95 96 97 |
# File 'lib/playwright_api/android_device.rb', line 95 def model wrap_impl(@impl.model) end |
#off(event, callback) ⇒ Object
– inherited from EventEmitter –
220 221 222 |
# File 'lib/playwright_api/android_device.rb', line 220 def off(event, callback) event_emitter_proxy.off(event, callback) end |
#on(event, callback) ⇒ Object
– inherited from EventEmitter –
214 215 216 |
# File 'lib/playwright_api/android_device.rb', line 214 def on(event, callback) event_emitter_proxy.on(event, callback) end |
#once(event, callback) ⇒ Object
– inherited from EventEmitter –
208 209 210 |
# File 'lib/playwright_api/android_device.rb', line 208 def once(event, callback) event_emitter_proxy.once(event, callback) end |
#open(command) ⇒ Object
Launches a process in the shell on the device and returns a socket to communicate with the launched process.
101 102 103 |
# File 'lib/playwright_api/android_device.rb', line 101 def open(command) raise NotImplementedError.new('open is not implemented yet.') end |
#pinch_close(selector, percent, speed: nil) ⇒ Object
Pinches the widget defined by ‘selector` in the closing direction.
107 108 109 |
# File 'lib/playwright_api/android_device.rb', line 107 def pinch_close(selector, percent, speed: nil) raise NotImplementedError.new('pinch_close is not implemented yet.') end |
#pinch_open(selector, percent, speed: nil) ⇒ Object
Pinches the widget defined by ‘selector` in the open direction.
113 114 115 |
# File 'lib/playwright_api/android_device.rb', line 113 def pinch_open(selector, percent, speed: nil) raise NotImplementedError.new('pinch_open is not implemented yet.') end |
#press(selector, key) ⇒ Object
Presses the specific ‘key` in the widget defined by `selector`.
119 120 121 |
# File 'lib/playwright_api/android_device.rb', line 119 def press(selector, key) raise NotImplementedError.new('press is not implemented yet.') end |
#push(file, path, mode: nil) ⇒ Object
Copies a file to the device.
125 126 127 |
# File 'lib/playwright_api/android_device.rb', line 125 def push(file, path, mode: nil) raise NotImplementedError.new('push is not implemented yet.') end |
#screenshot(path: nil) ⇒ Object
Returns the buffer with the captured screenshot of the device.
131 132 133 |
# File 'lib/playwright_api/android_device.rb', line 131 def screenshot(path: nil) wrap_impl(@impl.screenshot(path: unwrap_impl(path))) end |
#scroll(selector, direction, percent, speed: nil) ⇒ Object
Scrolls the widget defined by ‘selector` in the specified `direction`.
137 138 139 |
# File 'lib/playwright_api/android_device.rb', line 137 def scroll(selector, direction, percent, speed: nil) raise NotImplementedError.new('scroll is not implemented yet.') end |
#serial ⇒ Object
Device serial number.
143 144 145 |
# File 'lib/playwright_api/android_device.rb', line 143 def serial wrap_impl(@impl.serial) 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.
149 150 151 |
# File 'lib/playwright_api/android_device.rb', line 149 def set_default_timeout(timeout) raise NotImplementedError.new('set_default_timeout is not implemented yet.') end |
#shell(command) ⇒ Object
Executes a shell command on the device and returns its output.
156 157 158 |
# File 'lib/playwright_api/android_device.rb', line 156 def shell(command) wrap_impl(@impl.shell(unwrap_impl(command))) end |
#should_close_connection_on_close! ⇒ Object
197 198 199 |
# File 'lib/playwright_api/android_device.rb', line 197 def should_close_connection_on_close! wrap_impl(@impl.should_close_connection_on_close!) end |
#swipe(selector, direction, percent, speed: nil) ⇒ Object
Swipes the widget defined by ‘selector` in the specified `direction`.
162 163 164 |
# File 'lib/playwright_api/android_device.rb', line 162 def swipe(selector, direction, percent, speed: nil) raise NotImplementedError.new('swipe is not implemented yet.') end |
#tap_on(selector, duration: nil, timeout: nil) ⇒ Object
202 203 204 |
# File 'lib/playwright_api/android_device.rb', line 202 def tap_on(selector, duration: nil, timeout: nil) wrap_impl(@impl.tap_on(unwrap_impl(selector), duration: unwrap_impl(duration), timeout: unwrap_impl(timeout))) end |
#tap_point(selector, duration: nil) ⇒ Object
Taps on the widget defined by ‘selector`.
168 169 170 |
# File 'lib/playwright_api/android_device.rb', line 168 def tap_point(selector, duration: nil) raise NotImplementedError.new('tap_point is not implemented yet.') end |
#wait(selector, state: nil) ⇒ Object
Waits for the specific ‘selector` to either appear or disappear, depending on the `state`.
174 175 176 |
# File 'lib/playwright_api/android_device.rb', line 174 def wait(selector, state: nil) raise NotImplementedError.new('wait is not implemented yet.') end |
#wait_for_event(event, optionsOrPredicate: nil) ⇒ Object
Waits for event to fire and passes its value into the predicate function. Returns when the predicate returns truthy value.
180 181 182 |
# File 'lib/playwright_api/android_device.rb', line 180 def wait_for_event(event, optionsOrPredicate: nil) raise NotImplementedError.new('wait_for_event is not implemented yet.') end |
#web_view(selector) ⇒ Object
This method waits until ‘AndroidWebView` matching the `selector` is opened and returns it. If there is already an open `AndroidWebView` matching the `selector`, returns immediately.
186 187 188 |
# File 'lib/playwright_api/android_device.rb', line 186 def web_view(selector) raise NotImplementedError.new('web_view is not implemented yet.') end |
#web_views ⇒ Object
Currently open WebViews.
192 193 194 |
# File 'lib/playwright_api/android_device.rb', line 192 def web_views raise NotImplementedError.new('web_views is not implemented yet.') end |