Class: Appium::Core::Base::Driver
- Inherits:
-
Selenium::WebDriver::Driver
- Object
- Selenium::WebDriver::Driver
- Appium::Core::Base::Driver
- Includes:
- SearchContext, TakeScreenshot, Selenium::WebDriver::DriverExtensions::HasRemoteStatus, Selenium::WebDriver::DriverExtensions::HasSessionId, Selenium::WebDriver::DriverExtensions::HasWebStorage, Selenium::WebDriver::DriverExtensions::Rotatable, Selenium::WebDriver::DriverExtensions::UploadsFiles
- Defined in:
- lib/appium_lib_core/common/base/driver.rb
Constant Summary
Constants included from SearchContext
Instance Attribute Summary collapse
-
#bridge ⇒ Object
readonly
Private API.
Instance Method Summary collapse
-
#activate_app(app_id) ⇒ Hash
Activate(Launch) the specified app.
-
#app_installed?(app_id) ⇒ Boolean
Check whether the specified app is installed on the device.
-
#app_state(app_id) ⇒ AppState::STATUS
(also: #query_app_state)
Get the status of an existing application on the device.
-
#app_strings(language = nil) ⇒ Hash
Return the hash of all localization strings.
-
#available_contexts ⇒ Array<String>
All usable contexts, as an array of strings.
-
#back ⇒ String
Get the device window’s size.
-
#background_app(duration = 0) ⇒ String
Backgrounds the app for a set number of seconds.
-
#close_app ⇒ Object
Close an app on device.
- #compare_images(mode: :matchFeatures, first_image:, second_image:, options: nil) ⇒ Object
-
#context=(context = null) ⇒ Object
(also: #set_context)
Change the context to the given context.
-
#convert_to_element(id) ⇒ ::Selenium::WebDriver::Element
Convert vanilla element response to ::Selenium::WebDriver::Element.
-
#current_context ⇒ String
The context currently being used.
-
#device_time(format = nil) ⇒ String
Get the time on the device.
-
#dialect ⇒ :oss|:w3c
Get the dialect value.
-
#execute_driver(script: '', type: 'webdriverio', timeout_ms: nil) ⇒ Appium::Core::Base::Device::ExecuteDriver::Result
Run a set of script against the current session, allowing execution of many commands in one Appium request.
-
#find_element_by_image(img_path) ⇒ ::Selenium::WebDriver::Element
Return an element if current view has a partial image.
-
#find_elements_by_image(img_path) ⇒ ::Selenium::WebDriver::Element
Return elements if current view has a partial image.
- #find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil) ⇒ Object
- #get_images_similarity(first_image:, second_image:, visualize: false) ⇒ Object
-
#get_settings ⇒ Object
Get appium Settings for current test session.
-
#get_timeouts ⇒ Hash
For W3C.
-
#hide_keyboard(close_key = nil, strategy = nil) ⇒ Object
Hide the onscreen keyboard.
-
#ime ⇒ Object
Returns an instance of DeviceIME.
-
#ime_activate(ime_name) ⇒ Object
Android only.
- #ime_activated ⇒ Object
-
#ime_active_engine ⇒ Object
Android only.
-
#ime_available_engines ⇒ Object
Android only.
-
#ime_deactivate ⇒ Object
Android only.
-
#initialize(opts = {}) ⇒ Driver
constructor
A new instance of Driver.
-
#install_app(path, replace: nil, timeout: nil, allow_test_packages: nil, use_sdcard: nil, grant_permissions: nil) ⇒ Object
Install the given app onto the device.
-
#keyboard_shown? ⇒ Boolean
(also: #is_keyboard_shown)
Get whether keyboard is displayed or not.
-
#keyevent(key, metastate = nil) ⇒ Object
Send keyevent on the device.(Only for Selendroid) developer.android.com/reference/android/view/KeyEvent.html.
-
#launch_app ⇒ Object
Start the simulator and application configured with desired capabilities.
-
#lock(duration = nil) ⇒ String
Lock the device.
-
#locked? ⇒ Boolean
(also: #device_locked?)
Check current device status is weather locked or not.
-
#logs ⇒ String
Get the device window’s logs.
-
#long_press_keycode(key, metastate: [], flags: []) ⇒ Object
Long press keycode on the device.
-
#match_images_features(first_image:, second_image:, detector_name: 'ORB', match_func: 'BruteForce', good_matches_factor: nil, visualize: false) ⇒ Object
Image Comparison.
- #multi_touch(actions) ⇒ Object
-
#perform_actions(data) ⇒ Object
Send multiple W3C action chains to server.
-
#press_keycode(key, metastate: [], flags: []) ⇒ Object
Press keycode on the device.
-
#pull_file(path) ⇒ Base64-decoded
Pull a file from the simulator/device.
-
#pull_folder(path) ⇒ Base64-decoded
Pull a folder content from the simulator/device.
-
#push_file(path, filedata) ⇒ Object
Place a file in a specific location on the device.
- #remove_app(app_id, keep_data: nil, timeout: nil) ⇒ Object
-
#replace_value(element, *value) ⇒ Object
Replace the value to element directly.
-
#reset ⇒ Object
Reset the device, relaunching the application.
-
#send_keys(*key) ⇒ Object
(also: #type)
- DEPRECATION
-
Send keys for a current active element.
-
#session_capabilities ⇒ Selenium::WebDriver::Remote::Capabilities
Retrieve the capabilities of the specified session.
-
#sessions ⇒ [Hash]
Returns available sessions on the Appium server.
-
#set_immediate_value(element, *value) ⇒ Object
Set the value to element directly.
-
#settings ⇒ Object
Returns an instance of DriverSettings to call get/update.
-
#settings=(value) ⇒ Object
(also: #update_settings)
Update Appium Settings for current test session Alias of @driver.settings#update.
-
#shake ⇒ Object
Cause the device to shake.
- #stop_and_save_recording_screen(file_path) ⇒ Object
- #stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT') ⇒ Object
-
#switch_to_default_context ⇒ Object
Change to the default context.
-
#terminate_app(app_id, timeout: nil) ⇒ Boolean
Terminate the specified app.
-
#touch_actions(actions) ⇒ Object
touch actions.
-
#unlock ⇒ Object
Unlock the device.
-
#update_sending_request_to(protocol:, host:, port:, path:) ⇒ Object
Update
server_url
and HTTP clients following this arguments, protocol, host, port and path. -
#window_rect ⇒ Selenium::WebDriver::Rectangle
Get the device window’s rect.
-
#window_size ⇒ Selenium::WebDriver::Dimension
Get the device window’s size.
-
#within_context(context, &block) ⇒ Object
Perform a block within the given context, then switch back to the starting context.
Methods included from TakeScreenshot
#element_screenshot_as, #save_element_screenshot, #save_screenshot, #save_viewport_screenshot, #screenshot_as
Methods included from SearchContext
Constructor Details
#initialize(opts = {}) ⇒ Driver
Returns a new instance of Driver.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 36 def initialize(opts = {}) listener = opts.delete(:listener) @bridge = ::Appium::Core::Base::Bridge.handshake(**opts) if @bridge.dialect == :oss # MJSONWP extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen extend ::Selenium::WebDriver::DriverExtensions::HasLocation extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection elsif @bridge.dialect == :w3c # TODO: Only for Appium. Ideally, we'd like to remove the below like selenium-webdriver extend ::Selenium::WebDriver::DriverExtensions::HasTouchScreen extend ::Selenium::WebDriver::DriverExtensions::HasLocation extend ::Selenium::WebDriver::DriverExtensions::HasNetworkConnection end super(@bridge, listener: listener) end |
Instance Attribute Details
#bridge ⇒ Object (readonly)
Private API. Do not use this for general use. Used by flutter driver to get bridge for creating a new element
34 35 36 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 34 def bridge @bridge end |
Instance Method Details
#activate_app(app_id) ⇒ Hash
Activate(Launch) the specified app.
671 672 673 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 671 def activate_app(app_id) @bridge.activate_app(app_id) end |
#app_installed?(app_id) ⇒ Boolean
Check whether the specified app is installed on the device
660 661 662 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 660 def app_installed?(app_id) @bridge.app_installed?(app_id) end |
#app_state(app_id) ⇒ AppState::STATUS Also known as: query_app_state
Get the status of an existing application on the device. State:
:not_installed : The current application state cannot be determined/is unknown
:not_running : The application is not running
:running_in_background_suspended : The application is running in the background and is suspended
:running_in_background : The application is running in the background and is not suspended
:running_in_foreground : The application is running in the foreground
For more details: developer.apple.com/documentation/xctest/xcuiapplicationstate
710 711 712 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 710 def app_state(app_id) @bridge.app_state(app_id) end |
#app_strings(language = nil) ⇒ Hash
Return the hash of all localization strings.
586 587 588 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 586 def app_strings(language = nil) @bridge.app_strings(language) end |
#available_contexts ⇒ Array<String>
Returns All usable contexts, as an array of strings.
352 353 354 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 352 def available_contexts @bridge.available_contexts end |
#back ⇒ String
Get the device window’s size.
851 852 853 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 851 def back navigate.back end |
#background_app(duration = 0) ⇒ String
Backgrounds the app for a set number of seconds. This is a blocking application
601 602 603 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 601 def background_app(duration = 0) @bridge.background_app(duration) end |
#close_app ⇒ Object
Close an app on device
565 566 567 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 565 def close_app @bridge.close_app end |
#compare_images(mode: :matchFeatures, first_image:, second_image:, options: nil) ⇒ Object
1006 1007 1008 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 1006 def compare_images(mode: :matchFeatures, first_image:, second_image:, options: nil) @bridge.compare_images(mode: mode, first_image: first_image, second_image: second_image, options: ) end |
#context=(context = null) ⇒ Object Also known as: set_context
Change the context to the given context.
364 365 366 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 364 def context=(context = null) @bridge.set_context(context) end |
#convert_to_element(id) ⇒ ::Selenium::WebDriver::Element
Convert vanilla element response to ::Selenium::WebDriver::Element
1099 1100 1101 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 1099 def convert_to_element(id) @bridge.convert_to_element id end |
#current_context ⇒ String
Returns The context currently being used.
342 343 344 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 342 def current_context @bridge.current_context end |
#device_time(format = nil) ⇒ String
Get the time on the device
772 773 774 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 772 def device_time(format = nil) @bridge.device_time(format) end |
#dialect ⇒ :oss|:w3c
Get the dialect value
54 55 56 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 54 def dialect @bridge.dialect end |
#execute_driver(script: '', type: 'webdriverio', timeout_ms: nil) ⇒ Appium::Core::Base::Device::ExecuteDriver::Result
Run a set of script against the current session, allowing execution of many commands in one Appium request. Supports WebdriverIO API so far. Please read command API for more details about acceptable scripts and the output.
1085 1086 1087 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 1085 def execute_driver(script: '', type: 'webdriverio', timeout_ms: nil) @bridge.execute_driver(script: script, type: type, timeout_ms: timeout_ms) end |
#find_element_by_image(img_path) ⇒ ::Selenium::WebDriver::Element
Return an element if current view has a partial image. The logic depends on template matching by OpenCV. image-comparison
You can handle settings for the comparision following below. device-settings
1027 1028 1029 1030 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 1027 def find_element_by_image(img_path) template = Base64.strict_encode64 File.read img_path find_element :image, template end |
#find_elements_by_image(img_path) ⇒ ::Selenium::WebDriver::Element
Return elements if current view has a partial image. The logic depends on template matching by OpenCV. image-comparison
You can handle settings for the comparision following below. device-settings
1050 1051 1052 1053 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 1050 def find_elements_by_image(img_path) template = Base64.strict_encode64 File.read img_path find_elements :image, template end |
#find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil) ⇒ Object
995 996 997 998 999 1000 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 995 def find_image_occurrence(full_image:, partial_image:, visualize: false, threshold: nil) @bridge.find_image_occurrence(full_image: full_image, partial_image: partial_image, visualize: visualize, threshold: threshold) end |
#get_images_similarity(first_image:, second_image:, visualize: false) ⇒ Object
1002 1003 1004 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 1002 def get_images_similarity(first_image:, second_image:, visualize: false) @bridge.get_images_similarity(first_image: first_image, second_image: second_image, visualize: visualize) end |
#get_settings ⇒ Object
Get appium Settings for current test session. Alias of @driver.settings.get
192 193 194 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 192 def get_settings settings.get end |
#get_timeouts ⇒ Hash
For W3C. Get the timeout related settings on the server side.
875 876 877 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 875 def get_timeouts @bridge.get_timeouts end |
#hide_keyboard(close_key = nil, strategy = nil) ⇒ Object
Hide the onscreen keyboard
125 126 127 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 125 def hide_keyboard(close_key = nil, strategy = nil) @bridge.hide_keyboard close_key, strategy end |
#ime ⇒ Object
Returns an instance of DeviceIME
250 251 252 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 250 def ime @device_ime ||= DeviceIME.new(@bridge) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#ime_activate(ime_name) ⇒ Object
Android only. Make an engine that is available active.
263 264 265 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 263 def ime_activate(ime_name) ime.activate(ime_name) end |
#ime_activated ⇒ Object
297 298 299 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 297 def ime_activated ime.activated? end |
#ime_active_engine ⇒ Object
Android only. Get the name of the active IME engine.
285 286 287 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 285 def ime_active_engine ime.active_engine end |
#ime_available_engines ⇒ Object
Android only. List all available input engines on the machine.
274 275 276 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 274 def ime_available_engines ime.available_engines end |
#ime_deactivate ⇒ Object
Android only. De-activates the currently-active IME engine.
308 309 310 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 308 def ime_deactivate ime.deactivate end |
#install_app(path, replace: nil, timeout: nil, allow_test_packages: nil, use_sdcard: nil, grant_permissions: nil) ⇒ Object
Install the given app onto the device
625 626 627 628 629 630 631 632 633 634 635 636 637 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 625 def install_app(path, replace: nil, timeout: nil, allow_test_packages: nil, use_sdcard: nil, grant_permissions: nil) @bridge.install_app(path, replace: replace, timeout: timeout, allow_test_packages: allow_test_packages, use_sdcard: use_sdcard, grant_permissions: ) end |
#keyboard_shown? ⇒ Boolean Also known as: is_keyboard_shown
Get whether keyboard is displayed or not.
136 137 138 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 136 def keyboard_shown? @bridge.is_keyboard_shown end |
#keyevent(key, metastate = nil) ⇒ Object
Send keyevent on the device.(Only for Selendroid) developer.android.com/reference/android/view/KeyEvent.html
501 502 503 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 501 def keyevent(key, = nil) @bridge.keyevent(key, ) end |
#launch_app ⇒ Object
Start the simulator and application configured with desired capabilities
555 556 557 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 555 def launch_app @bridge.launch_app end |
#lock(duration = nil) ⇒ String
Lock the device
86 87 88 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 86 def lock(duration = nil) @bridge.lock(duration) end |
#locked? ⇒ Boolean Also known as: device_locked?
Check current device status is weather locked or not
97 98 99 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 97 def locked? @bridge.device_locked? end |
#logs ⇒ String
Get the device window’s logs.
863 864 865 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 863 def logs @logs ||= Logs.new(@bridge) end |
#long_press_keycode(key, metastate: [], flags: []) ⇒ Object
Long press keycode on the device. developer.android.com/reference/android/view/KeyEvent.html
545 546 547 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 545 def long_press_keycode(key, metastate: [], flags: []) @bridge.long_press_keycode(key, metastate: , flags: flags) end |
#match_images_features(first_image:, second_image:, detector_name: 'ORB', match_func: 'BruteForce', good_matches_factor: nil, visualize: false) ⇒ Object
Image Comparison
981 982 983 984 985 986 987 988 989 990 991 992 993 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 981 def match_images_features(first_image:, second_image:, detector_name: 'ORB', match_func: 'BruteForce', good_matches_factor: nil, visualize: false) @bridge.match_images_features(first_image: first_image, second_image: second_image, detector_name: detector_name, match_func: match_func, good_matches_factor: good_matches_factor, visualize: visualize) end |
#multi_touch(actions) ⇒ Object
781 782 783 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 781 def multi_touch(actions) @bridge.multi_touch(actions) end |
#perform_actions(data) ⇒ Object
Send multiple W3C action chains to server. Use @driver.action for single action chain.
@example: Zoom
f1 = @driver.action.add_pointer_input(:touch, 'finger1')
f1.create_pointer_move(duration: 1, x: 200, y: 500,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f1.create_pointer_down(:left)
f1.create_pointer_move(duration: 1, x: 200, y: 200,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f1.create_pointer_up(:left)
f2 = @driver.action.add_pointer_input(:touch, 'finger2')
f2.create_pointer_move(duration: 1, x: 200, y: 500,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f2.create_pointer_down(:left)
f2.create_pointer_move(duration: 1, x: 200, y: 800,
origin: ::Selenium::WebDriver::Interactions::PointerMove::VIEWPORT)
f2.create_pointer_up(:left)
@driver.perform_actions [f1, f2] #=> 'nil' if the action succeed
811 812 813 814 815 816 817 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 811 def perform_actions(data) raise ArgumentError, "'#{data}' must be Array" unless data.is_a? Array @bridge.send_actions data.map(&:encode).compact data.each(&:clear_actions) nil end |
#press_keycode(key, metastate: [], flags: []) ⇒ Object
Press keycode on the device. developer.android.com/reference/android/view/KeyEvent.html
523 524 525 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 523 def press_keycode(key, metastate: [], flags: []) @bridge.press_keycode(key, metastate: , flags: flags) end |
#pull_file(path) ⇒ Base64-decoded
Pull a file from the simulator/device. On iOS the server should have ifuse libraries installed and configured properly for this feature to work on real devices. On Android the application under test should be built with debuggable flag enabled in order to get access to its container on the internal file system.
454 455 456 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 454 def pull_file(path) @bridge.pull_file(path) end |
#pull_folder(path) ⇒ Base64-decoded
Pull a folder content from the simulator/device. On iOS the server should have ifuse libraries installed and configured properly for this feature to work on real devices. On Android the application under test should be built with debuggable flag enabled in order to get access to its container on the internal file system.
488 489 490 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 488 def pull_folder(path) @bridge.pull_folder(path) end |
#push_file(path, filedata) ⇒ Object
Place a file in a specific location on the device. On iOS, the server should have ifuse libraries installed and configured properly for this feature to work on real devices. On Android, the application under test should be built with debuggable flag enabled in order to get access to its container on the internal file system.
417 418 419 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 417 def push_file(path, filedata) @bridge.push_file(path, filedata) end |
#remove_app(app_id, keep_data: nil, timeout: nil) ⇒ Object
649 650 651 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 649 def remove_app(app_id, keep_data: nil, timeout: nil) @bridge.remove_app(app_id, keep_data: keep_data, timeout: timeout) end |
#replace_value(element, *value) ⇒ Object
Replace the value to element directly
387 388 389 390 391 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 387 def replace_value(element, *value) ::Appium::Logger.warn '[DEPRECATION] driver#replace_value(element, *value) is deprecated. ' \ 'Use Element#replace_value(*value) instead' @bridge.replace_value(element, *value) end |
#reset ⇒ Object
Reset the device, relaunching the application.
575 576 577 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 575 def reset @bridge.reset end |
#send_keys(*key) ⇒ Object Also known as: type
- DEPRECATION
-
Send keys for a current active element
149 150 151 152 153 154 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 149 def send_keys(*key) ::Appium::Logger.warn( '[DEPRECATION] Driver#send_keys is deprecated in W3C spec. Use driver.action.<command>.perform instead' ) @bridge.send_keys_to_active_element(key) end |
#session_capabilities ⇒ Selenium::WebDriver::Remote::Capabilities
Retrieve the capabilities of the specified session. It’s almost same as @driver.capabilities but you can get more details.
964 965 966 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 964 def session_capabilities @bridge.session_capabilities end |
#sessions ⇒ [Hash]
Returns available sessions on the Appium server
976 977 978 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 976 def sessions @bridge.sessions end |
#set_immediate_value(element, *value) ⇒ Object
Set the value to element directly
375 376 377 378 379 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 375 def set_immediate_value(element, *value) ::Appium::Logger.warn '[DEPRECATION] driver#set_immediate_value(element, *value) is deprecated. ' \ 'Use Element#immediate_value(*value) instead' @bridge.set_immediate_value(element, *value) end |
#settings ⇒ Object
Returns an instance of DriverSettings to call get/update.
180 181 182 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 180 def settings @driver_settings ||= DriverSettings.new(@bridge) # rubocop:disable Naming/MemoizedInstanceVariableName end |
#settings=(value) ⇒ Object Also known as: update_settings
Update Appium Settings for current test session Alias of @driver.settings#update
207 208 209 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 207 def settings=(value) settings.update(value) end |
#shake ⇒ Object
Cause the device to shake
756 757 758 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 756 def shake @bridge.shake end |
#stop_and_save_recording_screen(file_path) ⇒ Object
746 747 748 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 746 def stop_and_save_recording_screen(file_path) @bridge.stop_and_save_recording_screen(file_path) end |
#stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT') ⇒ Object
730 731 732 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 730 def stop_recording_screen(remote_path: nil, user: nil, pass: nil, method: 'PUT') @bridge.stop_recording_screen(remote_path: remote_path, user: user, pass: pass, method: method) end |
#switch_to_default_context ⇒ Object
Change to the default context. This is equivalent to set_context nil.
332 333 334 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 332 def switch_to_default_context @bridge.switch_to_default_context end |
#terminate_app(app_id, timeout: nil) ⇒ Boolean
Terminate the specified app.
687 688 689 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 687 def terminate_app(app_id, timeout: nil) @bridge.terminate_app(app_id, timeout: timeout) end |
#touch_actions(actions) ⇒ Object
touch actions
777 778 779 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 777 def touch_actions(actions) @bridge.touch_actions(actions) end |
#unlock ⇒ Object
Unlock the device
108 109 110 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 108 def unlock @bridge.unlock end |
#update_sending_request_to(protocol:, host:, port:, path:) ⇒ Object
Update server_url
and HTTP clients following this arguments, protocol, host, port and path. After this method, @bridge.http will be a new instance following them instead of server_url
which is set before creating session.
68 69 70 71 72 73 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 68 def update_sending_request_to(protocol:, host:, port:, path:) @bridge.http.update_sending_request_to(scheme: protocol, host: host, port: port, path: path) end |
#window_rect ⇒ Selenium::WebDriver::Rectangle
Get the device window’s rect.
841 842 843 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 841 def window_rect manage.window.rect end |
#window_size ⇒ Selenium::WebDriver::Dimension
Get the device window’s size.
827 828 829 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 827 def window_size manage.window.size end |
#within_context(context, &block) ⇒ Object
Perform a block within the given context, then switch back to the starting context.
322 323 324 |
# File 'lib/appium_lib_core/common/base/driver.rb', line 322 def within_context(context, &block) block_given? ? @bridge.within_context(context, &block) : @bridge.within_context(context) end |