appium.webdriver.extensions package — Python client 1.0 1.0 documentation

# appium.webdriver.extensions package

## Subpackages

- appium.webdriver.extensions.android package
  - Submodules
  - appium.webdriver.extensions.android.activities module
  - appium.webdriver.extensions.android.common module
  - appium.webdriver.extensions.android.display module
  - appium.webdriver.extensions.android.gsm module
  - appium.webdriver.extensions.android.nativekey module
  - appium.webdriver.extensions.android.network module
  - appium.webdriver.extensions.android.performance module
  - appium.webdriver.extensions.android.power module
  - appium.webdriver.extensions.android.sms module
  - appium.webdriver.extensions.android.system_bars module
  - Module contents
- appium.webdriver.extensions.search_context package
  - Submodules
  - appium.webdriver.extensions.search_context.android module
  - appium.webdriver.extensions.search_context.base_search_context module
  - appium.webdriver.extensions.search_context.custom module
  - appium.webdriver.extensions.search_context.ios module
  - appium.webdriver.extensions.search_context.mobile module
  - appium.webdriver.extensions.search_context.windows module
  - Module contents

## Submodules

## appium.webdriver.extensions.action_helpers module

class ActionHelpers(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  drag_and_drop(origin_el: appium.webdriver.webelement.WebElement, destination_el: appium.webdriver.webelement.WebElement) → appium.webdriver.extensions.action_helpers.T

    Drag the origin element to the destination element

    Parameters

      - origin_el – the element to drag

      - destination_el – the element to drag to

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘ActionHelpers’]

  flick(start_x: int, start_y: int, end_x: int, end_y: int) → appium.webdriver.extensions.action_helpers.T

    Flick from one point to another point.

    Parameters

      - start_x – x-coordinate at which to start

      - start_y – y-coordinate at which to start

      - end_x – x-coordinate at which to stop

      - end_y – y-coordinate at which to stop

    Usage:

      driver.flick(100, 100, 100, 400)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘ActionHelpers’]

  scroll(origin_el: appium.webdriver.webelement.WebElement, destination_el: appium.webdriver.webelement.WebElement, duration: Optional[int] = None) → appium.webdriver.extensions.action_helpers.T

    Scrolls from one element to another

    Parameters

      - origin_el – the element from which to being scrolling

      - destination_el – the element to scroll to

      - duration – a duration after pressing originalEl and move the element to destinationEl. Default is 600 ms for W3C spec.

    Usage:

      driver.scroll(el1, el2)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘ActionHelpers’]

  swipe(start_x: int, start_y: int, end_x: int, end_y: int, duration: int = 0) → appium.webdriver.extensions.action_helpers.T

    Swipe from one point to another point, for an optional duration.

    Parameters

      - start_x – x-coordinate at which to start

      - start_y – y-coordinate at which to start

      - end_x – x-coordinate at which to stop

      - end_y – y-coordinate at which to stop

      - duration – time to take the swipe, in ms.

    Usage:

      driver.swipe(100, 100, 100, 400)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘ActionHelpers’]

  tap(positions: List[Tuple[int, int]], duration: Optional[int] = None) → appium.webdriver.extensions.action_helpers.T

    Taps on an particular place with up to five fingers, holding for a certain time

    Parameters

      - positions – an array of tuples representing the x/y coordinates of the fingers to tap. Length can be up to five.

      - duration – length of time to tap, in ms

    Usage:

      driver.tap([(100, 20), (100, 60), (100, 100)], 500)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘ActionHelpers’]

## appium.webdriver.extensions.applications module

class Applications(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  activate_app(app_id: str) → appium.webdriver.extensions.applications.T

    Activates the application if it is not running or is running in the background.

    Parameters

      app_id – the application id to be activated

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Applications’]

  app_strings(language: Optional[str] = None, string_file: Optional[str] = None) → Dict[str, str]

    Returns the application strings from the device for the specified language.

    Parameters

      - language – strings language code

      - string_file – the name of the string file to query

    Returns

      The key is string id and the value is the content.

  background_app(seconds: int) → appium.webdriver.extensions.applications.T

    Puts the application in the background on the device for a certain duration.

    Parameters

      seconds – the duration for the application to remain in the background

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Applications’]

  close_app() → appium.webdriver.extensions.applications.T

    Stop the running application, specified in the desired capabilities, on the device.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Applications’]

  install_app(app_path: str, **options: Any) → appium.webdriver.extensions.applications.T

    Install the application found at app_path on the device.

    Parameters

      app_path – the local or remote path to the application to install

    Keyword Arguments

      - replace (bool) – [Android only] whether to reinstall/upgrade the package if it is already present on the device under test. True by default

      - timeout (int) – [Android only] how much time to wait for the installation to complete. 60000ms by default.

      - allowTestPackages (bool) – [Android only] whether to allow installation of packages marked as test in the manifest. False by default

      - useSdcard (bool) – [Android only] whether to use the SD card to install the app. False by default

      - grantPermissions (bool) – [Android only] whether to automatically grant application permissions on Android 6+ after the installation completes. False by default

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Applications’]

  is_app_installed(bundle_id: str) → bool

    Checks whether the application specified by bundle_id is installed on the device.

    Parameters

      bundle_id – the id of the application to query

    Returns

      True if app is installed

  launch_app() → appium.webdriver.extensions.applications.T

    Start on the device the application specified in the desired capabilities.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Applications’]

  query_app_state(app_id: str) → int

    Queries the state of the application.

    Parameters

      app_id – the application id to be queried

    Returns

      One of possible application state constants. See ApplicationState class for more details.

  remove_app(app_id: str, **options: Any) → appium.webdriver.extensions.applications.T

    Remove the specified application from the device.

    Parameters

      app_id – the application id to be removed

    Keyword Arguments

      - keepData (bool) – [Android only] whether to keep application data and caches after it is uninstalled. False by default

      - timeout (int) – [Android only] how much time to wait for the uninstall to complete. 20000ms by default.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Applications’]

  reset() → appium.webdriver.extensions.applications.T

    Resets the current application on the device.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Applications’]

  terminate_app(app_id: str, **options: Any) → bool

    Terminates the application if it is running.

    Parameters

      app_id – the application id to be terminates

    Keyword Arguments

      timeout (int) – [Android only] how much time to wait for the uninstall to complete. 500ms by default.

    Returns

      True if the app has been successfully terminated

## appium.webdriver.extensions.clipboard module

class Clipboard(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  get_clipboard(content_type: str = 'plaintext') → bytes

    Receives the content of the system clipboard

    Parameters

      content_type – One of ClipboardContentType items. Only ClipboardContentType.PLAINTEXT is supported on Android

    Returns

      Clipboard content. Or return an empty string if the clipboard is empty

    Return type

      base64-encoded string

  get_clipboard_text() → str

    Receives the text of the system clipboard

    Returns

      The actual clipboard text or an empty string if the clipboard is empty

  set_clipboard(content: bytes, content_type: str = 'plaintext', label: Optional[str] = None) → appium.webdriver.extensions.clipboard.T

    Set the content of the system clipboard

    Parameters

      - content – The content to be set as bytearray string

      - content_type – One of ClipboardContentType items. Only ClipboardContentType.PLAINTEXT is supported on Android

      - label – label argument, which only works for Android

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Clipboard’]

  set_clipboard_text(text: str, label: Optional[str] = None) → appium.webdriver.extensions.clipboard.T

    Copies the given text to the system clipboard

    Parameters

      - text – The text to be set

      - label – label argument, which only works for Android

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Clipboard’]

## appium.webdriver.extensions.context module

class Context(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  property context: str

    Returns the current context of the current session.

    Usage:

      driver.context

    Returns

      The context of the current session

    Return type

      str

  property contexts: List[str]

    Returns the contexts within the current session.

    Usage:

      driver.contexts

    Returns

      The contexts within the current session

    Return type

      `list` of `str`

  property current_context: str

    Returns the current context of the current session.

    Usage:

      driver.current_context

    Returns

      The context of the current session

    Return type

      str

## appium.webdriver.extensions.device_time module

class DeviceTime(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  property device_time: str

    Returns the date and time from the device.

    Returns

      The date and time

    Return type

      str

  get_device_time(format: Optional[str] = None) → str

    Returns the date and time from the device.

    Parameters

      format – The set of format specifiers. Read https://momentjs.com/docs/ to get the full list of supported datetime format specifiers. If unset, return `device_time()` as default format is YYYY-MM-DDTHH:mm:ssZ, which complies to ISO-8601

    Usage:
      self.driver.get_device_time()
      self.driver.get_device_time(“YYYY-MM-DD”)
    Returns

      The date and time

    Return type

      str

## appium.webdriver.extensions.execute_driver module

class ExecuteDriver(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  execute_driver(script: str, script_type: str = 'webdriverio', timeout_ms: Optional[int] = None) → Any

    Run a set of script against the current session, allowing execution of many commands in one Appium request. Please read http://appium.io/docs/en/commands/session/execute-driver for more details about the acceptable scripts and the output format.

    Parameters

      - script – The string consisting of the script itself

      - script_type – The name of the script type. Defaults to ‘webdriverio’.

      - timeout_ms – The number of ms Appium should wait for the script to finish before killing it due to timeout_ms.

    Usage:
      self.driver.execute_driver(script=’return [];’)
      self.driver.execute_driver(script=’return [];’, script_type=’webdriverio’)
      self.driver.execute_driver(script=’return [];’, script_type=’webdriverio’, timeout_ms=10000)
    Returns

      The result of the script. It has ‘result’ and ‘logs’ keys.

    Return type

      ExecuteDriver.Result

    Raises

      WebDriverException – If something error happenes in the script. The message has the original error message.

## appium.webdriver.extensions.execute_mobile_command module

class ExecuteMobileCommand(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  property battery_info: Dict[str, Any]

    Retrieves battery information for the device under test.

    Returns

      containing the following entries
        level: Battery level in range [0.0, 1.0], where 1.0 means 100% charge.

          Any value lower than 0 means the level cannot be retrieved

        state: Platform-dependent battery state value.
          On iOS (XCUITest):

            1: Unplugged 2: Charging 3: Full Any other value means the state cannot be retrieved

          On Android (UIAutomator2):

            2: Charging 3: Discharging 4: Not charging 5: Full Any other value means the state cannot be retrieved

    Return type

      dict

  press_button(button_name: str) → appium.webdriver.extensions.execute_mobile_command.T

    Sends a physical button name to the device to simulate the user pressing.

    iOS only. Possible button names can be found in https://github.com/appium/WebDriverAgent/blob/master/WebDriverAgentLib/Categories/XCUIDevice%2BFBHelpers.h

    Parameters

      button_name – the button name to be sent to the device

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘ExecuteMobileCommand’]

## appium.webdriver.extensions.hw_actions module

class HardwareActions(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  finger_print(finger_id: int) → Any

    Authenticate users by using their finger print scans on supported Android emulators.

    Parameters

      finger_id – Finger prints stored in Android Keystore system (from 1 to 10)

    Returns

      TODO

  is_locked() → bool

    Checks whether the device is locked.

    Returns

      True if the device is locked

  lock(seconds: Optional[int] = None) → appium.webdriver.extensions.hw_actions.T

    Lock the device. No changes are made if the device is already unlocked.

    Parameters

      seconds – The duration to lock the device, in seconds. The device is going to be locked forever until unlock is called if it equals or is less than zero, otherwise this call blocks until the timeout expires and unlocks the screen automatically.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘HardwareActions’]

  shake() → appium.webdriver.extensions.hw_actions.T

    Shake the device.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘HardwareActions’]

  toggle_touch_id_enrollment() → appium.webdriver.extensions.hw_actions.T

    Toggle enroll touchId on iOS Simulator

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘HardwareActions’]

  touch_id(match: bool) → appium.webdriver.extensions.hw_actions.T

    Simulate touchId on iOS Simulator

    Parameters

      match – Simulates a successful touch (True) or a failed touch (False)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘HardwareActions’]

  unlock() → appium.webdriver.extensions.hw_actions.T

    Unlock the device. No changes are made if the device is already locked.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘HardwareActions’]

## appium.webdriver.extensions.images_comparison module

class ImagesComparison(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  find_image_occurrence(base64_full_image: bytes, base64_partial_image: bytes, **opts: Any) → Dict[str, Union[bytes, Dict]]

    Performs images matching by template to find possible occurrence of the partial image in the full image.

    Read https://docs.opencv.org/2.4/doc/tutorials/imgproc/histograms/template_matching/template_matching.html for more details on this topic. The method supports all image formats, which are supported by OpenCV itself.

    Parameters

      - base64_full_image – base64-encoded content of the full image

      - base64_partial_image – base64-encoded content of the partial image

    Keyword Arguments

      visualize (bool) – Set it to True in order to return the visualization of the matching operation. False by default

    Returns

      visualization (bytes): base64-encoded content of PNG visualization of the current comparison

        operation. This entry is only present if visualize option is enabled

      rect (dict): The region of the partial image occurrence on the full image.

        The rect is represented by a dictionary with ‘x’, ‘y’, ‘width’ and ‘height’ keys

    Return type

      The dictionary containing the following entries

  get_images_similarity(base64_image1: bytes, base64_image2: bytes, **opts: Any) → Dict[str, Union[bytes, Dict]]

    Performs images matching to calculate the similarity score between them.

    The flow there is similar to the one used in find_image_occurrence, but it is mandatory that both images are of equal resolution. The method supports all image formats, which are supported by OpenCV itself.

    Parameters

      - base64_image1 – base64-encoded content of the first image

      - base64_image2 – base64-encoded content of the second image

    Keyword Arguments

      visualize (boo) – Set it to True in order to return the visualization of the matching operation. False by default

    Returns

      visualization (bytes): base64-encoded content of PNG visualization of the current comparison

        operation. This entry is only present if visualize option is enabled

      score (float): The similarity score as a float number in range [0.0, 1.0].

        1.0 is the highest score (means both images are totally equal).

    Return type

      The dictionary containing the following entries

  match_images_features(base64_image1: bytes, base64_image2: bytes, **opts: Any) → Dict[str, Any]

    Performs images matching by features.

    Read https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_matcher/py_matcher.html for more details on this topic. The method supports all image formats, which are supported by OpenCV itself.

    Parameters

      - base64_image1 – base64-encoded content of the first image

      - base64_image2 – base64-encoded content of the second image

    Keyword Arguments

      - visualize (bool) – Set it to True in order to return the visualization of the matching operation. matching visualization. False by default

      - detectorName (str) – One of possible feature detector names: ‘AKAZE’, ‘AGAST’, ‘BRISK’, ‘FAST’, ‘GFTT’, ‘KAZE’, ‘MSER’, ‘SIFT’, ‘ORB’ Some of these detectors are not enabled in the default OpenCV deployment. ‘ORB’ By default.

      - matchFunc (str) – One of supported matching functions names: ‘FlannBased’, ‘BruteForce’, ‘BruteForceL1’, ‘BruteForceHamming’, ‘BruteForceHammingLut’, ‘BruteForceSL2’ ‘BruteForce’ by default

      - goodMatchesFactor (int) – The maximum count of “good” matches (e. g. with minimal distances). This count is unlimited by default.

    Returns

      visualization (bytes): base64-encoded content of PNG visualization of the current comparison

        operation. This entry is only present if visualize option is enabled

      count (int): The count of matched edges on both images.

        The more matching edges there are no both images the more similar they are.

      totalCount (int): The total count of matched edges on both images.

        It is equal to count if goodMatchesFactor does not limit the matches, otherwise it contains the total count of matches before goodMatchesFactor is applied.

      points1 (dict): The array of matching points on the first image. Each point is a dictionary

        with ‘x’ and ‘y’ keys

      rect1 (dict): The bounding rect for the points1 array or a zero rect if not enough matching points

        were found. The rect is represented by a dictionary with ‘x’, ‘y’, ‘width’ and ‘height’ keys

      points2 (dict): The array of matching points on the second image. Each point is a dictionary

        with ‘x’ and ‘y’ keys

      rect2 (dict): The bounding rect for the points2 array or a zero rect if not enough matching points

        were found. The rect is represented by a dictionary with ‘x’, ‘y’, ‘width’ and ‘height’ keys

    Return type

      The dictionary containing the following entries

## appium.webdriver.extensions.ime module

class IME(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  activate_ime_engine(engine: str) → appium.webdriver.extensions.ime.T

    Activates the given IME engine on the device.

    Android only.

    Parameters

      engine – the package and activity of the IME engine to activate (e.g., ‘com.android.inputmethod.latin/.LatinIME’)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘IME’]

  property active_ime_engine: str

    Returns the activity and package of the currently active IME engine (e.g., ‘com.android.inputmethod.latin/.LatinIME’).

    Android only.

    Returns

      The activity and package of the currently active IME engine

    Return type

      str

  property available_ime_engines: List[str]

    Get the available input methods for an Android device.

    Package and activity are returned (e.g., [‘com.android.inputmethod.latin/.LatinIME’]) Android only.

    Returns

      The available input methods for an Android device

    Return type

      `list` of `str`

  deactivate_ime_engine() → appium.webdriver.extensions.ime.T

    Deactivates the currently active IME engine on the device.

    Android only.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘IME’]

  is_ime_active() → bool

    Checks whether the device has IME service active. Android only.

    Returns

      True if IME service is active

## appium.webdriver.extensions.keyboard module

class Keyboard(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  hide_keyboard(key_name: Optional[str] = None, key: Optional[str] = None, strategy: Optional[str] = None) → appium.webdriver.extensions.keyboard.T

    Hides the software keyboard on the device.

    In iOS, use key_name to press a particular key, or strategy. In Android, no parameters are used.

    Parameters

      - key_name – key to press

      - key –

      - strategy – strategy for closing the keyboard (e.g., tapOutside)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Keyboard’]

  is_keyboard_shown() → bool

    Attempts to detect whether a software keyboard is present

    Returns

      True if keyboard is shown

  keyevent(keycode: int, metastate: Optional[int] = None) → appium.webdriver.extensions.keyboard.T

    Sends a keycode to the device.

    Android only. Possible keycodes can be found in http://developer.android.com/reference/android/view/KeyEvent.html.

    Parameters

      - keycode – the keycode to be sent to the device

      - metastate – meta information about the keycode being sent

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Keyboard’]

  long_press_keycode(keycode: int, metastate: Optional[int] = None, flags: Optional[int] = None) → appium.webdriver.extensions.keyboard.T

    Sends a long press of keycode to the device.

    Android only. Possible keycodes can be found in http://developer.android.com/reference/android/view/KeyEvent.html.

    Parameters

      - keycode – the keycode to be sent to the device

      - metastate – meta information about the keycode being sent

      - flags – the set of key event flags

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Keyboard’]

  press_keycode(keycode: int, metastate: Optional[int] = None, flags: Optional[int] = None) → appium.webdriver.extensions.keyboard.T

    Sends a keycode to the device.

    Android only. Possible keycodes can be found in http://developer.android.com/reference/android/view/KeyEvent.html.

    Parameters

      - keycode – the keycode to be sent to the device

      - metastate – meta information about the keycode being sent

      - flags – the set of key event flags

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Keyboard’]

## appium.webdriver.extensions.location module

class Location(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  property location: Dict[str, float]

    Retrieves the current location

    Returns

      A dictionary whose keys are

        - latitude (float)

        - longitude (float)

        - altitude (float)

  set_location(latitude: Union[float, str], longitude: Union[float, str], altitude: Optional[Union[float, str]] = None, speed: Optional[Union[float, str]] = None, satellites: Optional[Union[float, str]] = None) → appium.webdriver.extensions.location.T

    Set the location of the device

    Parameters

      - latitude – String or numeric value between -90.0 and 90.00

      - longitude – String or numeric value between -180.0 and 180.0

      - altitude – String or numeric value (Android real device only)

      - speed – String or numeric value larger than 0.0 (Android real devices only)

      - satellites – String or numeric value of active GPS satellites in range 1..12. (Android emulators only)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Location’]

  toggle_location_services() → appium.webdriver.extensions.location.T

    Toggle the location services on the device.

    Android only.

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘Location’]

## appium.webdriver.extensions.log_event module

class LogEvent(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  get_events(type: Optional[List[str]] = None) → Dict[str, Union[str, int]]

    Retrieves events information from the current session (Since Appium 1.16.0)

    Parameters

      type – The event type to filter with

    Usage:
      events = driver.get_events()
      events = driver.get_events([‘appium:funEvent’])
    Returns

      A dictionary of events timing information containing the following entries
        commands: (list of dict) List of dictionaries containing the following entries
        cmd: The command name that has been sent to the appium server
        startTime: Received time
        endTime: Response time
    Return type

      dict

  log_event(vendor: str, event: str) → appium.webdriver.extensions.log_event.T

    Log a custom event on the Appium server. (Since Appium 1.16.0)

    Parameters

      - vendor – The vendor to log

      - event – The event to log

    Usage:

      driver.log_event(‘appium’, ‘funEvent’)

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘LogEvent’]

## appium.webdriver.extensions.remote_fs module

class RemoteFS(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  pull_file(path: str) → str

    Retrieves the file at path.

    Parameters

      path – the path to the file on the device

    Returns

      The file’s contents encoded as Base64.

  pull_folder(path: str) → str

    Retrieves a folder at path.

    Parameters

      path – the path to the folder on the device

    Returns

      The folder’s contents zipped and encoded as Base64.

  push_file(destination_path: str, base64data: Optional[str] = None, source_path: Optional[str] = None) → appium.webdriver.extensions.remote_fs.T

    Puts the data from the file at source_path, encoded as Base64, in the file specified as path.

    Specify either base64data or source_path, if both specified default to source_path

    Parameters

      - destination_path – the location on the device/simulator where the local file contents should be saved

      - base64data – file contents, encoded as Base64, to be written

      - device/simulator (to the file on the) –

      - source_path – local file path for the file to be loaded on device

    Returns

      Self instance

    Return type

      Union[‘WebDriver’, ‘RemoteFS’]

## appium.webdriver.extensions.screen_record module

class ScreenRecord(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  start_recording_screen(**options: Any) → Union[bytes, str]

    Start asynchronous screen recording process.

    Keyword Args | iOS | Android | Win | macOS
    --- | --- | --- | --- | ---
    remotePath | O | O | O | O
    user | O | O | O | O
    password | O | O | O | O
    method | O | O | O | O
    timeLimit | O | O | O | O
    forceRestart | O | O | O | O
    fileFieldName | O | O | O | O
    formFields | O | O | O | O
    headers | O | O | O | O
    videoQuality | O |  |  |
    videoType | O |  |  |
    videoFps | O |  |  |
    videoFilter | O |  | O | O
    videoScale | O |  |  |
    pixelFormat | O |  |  |
    videoSize |  | O |  |
    bitRate |  | O |  |
    bugReport |  | O |  |
    fps |  |  | O | O
    captureCursor |  |  | O | O
    captureClicks |  |  | O | O
    deviceId |  |  |  | O
    preset |  |  | O | O
    audioInput |  |  | O |

    Keyword Arguments

      - remotePath (str) – The remotePath upload option is the path to the remote location, where the resulting video from the previous screen recording should be uploaded. The following protocols are supported: http/https (multipart), ftp. Missing value (the default setting) means the content of the resulting file should be encoded as Base64 and passed as the endpoint response value, but an exception will be thrown if the generated media file is too big to fit into the available process memory. This option only has an effect if there is/was an active screen recording session and forced restart is not enabled (the default setting).

      - user (str) – The name of the user for the remote authentication. Only has an effect if both remotePath and password are set.

      - password (str) – The password for the remote authentication. Only has an effect if both remotePath and user are set.

      - method (str) – The HTTP method name (‘PUT’/’POST’). PUT method is used by default. Only has an effect if remotePath is set.

      - timeLimit (int) – The actual time limit of the recorded video in seconds. The default value for both iOS and Android is 180 seconds (3 minutes). The default value for macOS is 600 seconds (10 minutes). The maximum value for Android is 3 minutes. The maximum value for iOS is 10 minutes. The maximum value for macOS is 10000 seconds (166 minutes).

      - forcedRestart (bool) – Whether to ignore the result of previous capture and start a new recording immediately (True value). By default (False) the endpoint will try to catch and return the result of the previous capture if it’s still available.

      - fileFieldName (str) – [multipart/form-data requests] The name of the form field containing the binary payload. “file” by default. (Since Appium 1.18.0)

      - formFields (dict) – [multipart/form-data requests] Additional form fields mapping. If any entry has the same key as fileFieldName then it is going to be ignored. (Since Appium 1.18.0)

      - headers (dict) – [multipart/form-data requests] Headers mapping (Since Appium 1.18.0)

      - videoQuality (str) – [iOS] The video encoding quality: ‘low’, ‘medium’, ‘high’, ‘photo’. Defaults to ‘medium’.

      - videoType (str) – [iOS] The format of the screen capture to be recorded. Available formats: Execute ffmpeg -codecs in the terminal to see the list of supported video codecs. ‘mjpeg’ by default. (Since Appium 1.10.0)

      - videoFps (int) – [iOS] The Frames Per Second rate of the recorded video. Change this value if the resulting video is too slow or too fast. Defaults to 10. This can decrease the resulting file size.

      - videoFilters (str) – [iOS, Win, macOS] The FFMPEG video filters to apply. These filters allow to scale, flip, rotate and do many other useful transformations on the source video stream. The format of the property must comply with https://ffmpeg.org/ffmpeg-filters.html. (Since Appium 1.15)

      - videoScale (str) – [iOS] The scaling value to apply. Read https://trac.ffmpeg.org/wiki/Scaling for possible values. No scale is applied by default. If videoFilters are set then the scale setting is effectively ignored. (Since Appium 1.10.0)

      - pixelFormat (str) – [iOS] Output pixel format. Run ffmpeg -pix_fmts to list possible values. For Quicktime compatibility, set to “yuv420p” along with videoType: “libx264”. (Since Appium 1.12.0)

      - videoSize (str) – [Android] The video size of the generated media file. The format is WIDTHxHEIGHT. The default value is the device’s native display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device’s Advanced Video Coding (AVC) encoder.

      - bitRate (int) – [Android] The video bit rate for the video, in megabits per second. The default value is 4. You can increase the bit rate to improve video quality, but doing so results in larger movie files.

      - bugReport (str) – [Android] Makes the recorder to display an additional information on the video overlay, such as a timestamp, that is helpful in videos captured to illustrate bugs. This option is only supported since API level 27 (Android P).

      - fps (int) – [Win, macOS] The count of frames per second in the resulting video. Increasing fps value also increases the size of the resulting video file and the CPU usage.

      - captureCursor (bool) – [Win, macOS] Whether to capture the mouse cursor while recording the screen. Disabled by default.

      - captureClick (bool) – [Win, macOS] Whether to capture the click gestures while recording the screen. Disabled by default.

      - deviceId (int) – [macOS] Screen device index to use for the recording. The list of available devices could be retrieved using ffmpeg -f avfoundation -list_devices true -i command. This option is mandatory and must be always provided.

      - preset (str) – [Win, macOS] A preset is a collection of options that will provide a certain encoding speed to compression ratio. A slower preset will provide better compression (compression is quality per filesize). This means that, for example, if you target a certain file size or constant bit rate, you will achieve better quality with a slower preset. Read https://trac.ffmpeg.org/wiki/Encode/H.264 for more details. Possible values are ‘ultrafast’, ‘superfast’, ‘veryfast’(default), ‘faster’, ‘fast’, ‘medium’, ‘slow’, ‘slower’, ‘veryslow’

    Returns

      Base-64 encoded content of the recorded media

        if stop_recording_screen isn’t called after previous start_recording_screen. Otherwise returns an empty string.

    Return type

      bytes

  stop_recording_screen(**options: Any) → bytes

    Gather the output from the previously started screen recording to a media file.

    Keyword Arguments

      - remotePath (str) – The remotePath upload option is the path to the remote location, where the resulting video should be uploaded. The following protocols are supported: http/https (multipart), ftp. Missing value (the default setting) means the content of the resulting file should be encoded as Base64 and passed as the endpoint response value, but an exception will be thrown if the generated media file is too big to fit into the available process memory.

      - user (str) – The name of the user for the remote authentication. Only has an effect if both remotePath and password are set.

      - password (str) – The password for the remote authentication. Only has an effect if both remotePath and user are set.

      - method (str) – The HTTP method name (‘PUT’/’POST’). PUT method is used by default. Only has an effect if remotePath is set.

      - fileFieldName (str) – [multipart/form-data requests] The name of the form field containing the binary payload. “file” by default. (Since Appium 1.18.0)

      - formFields (dict) – [multipart/form-data requests] Additional form fields mapping. If any entry has the same key as fileFieldName then it is going to be ignored. (Since Appium 1.18.0)

      - headers (dict) – [multipart/form-data requests] Headers mapping (Since Appium 1.18.0)

    Returns

      Base-64 encoded content of the recorded media file or an empty string

        if the file has been successfully uploaded to a remote location (depends on the actual remotePath value).

    Return type

      bytes

## appium.webdriver.extensions.session module

class Session(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  property all_sessions: List[Dict[str, Any]]

    Retrieves all sessions that are open

    Usage:

      sessions = driver.all_sessions

    Returns

      containing all open sessions

    Return type

      `list` of `dict`

  property events: Dict

    Retrieves events information from the current session

    Usage:

      events = driver.events

    Returns

      containing events timing information from the current session

    Return type

      dict

  property session: Dict[str, Any]

    Retrieves session information from the current session

    Usage:

      session = driver.session

    Returns

      containing information from the current session

    Return type

      dict

## appium.webdriver.extensions.settings module

class Settings(command_executor='http://127.0.0.1:4444', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=True, file_detector=None, options: Optional[Union[selenium.webdriver.common.options.BaseOptions, List[selenium.webdriver.common.options.BaseOptions]]] = None)

  Bases: `selenium.webdriver.remote.webdriver.WebDriver`

  get_settings() → Dict[str, Any]

    Returns the appium server Settings for the current session.

    Do not get Settings confused with Desired Capabilities, they are separate concepts. See https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/settings.md

    Returns

      Current settings

  update_settings(settings: Dict[str, Any]) → appium.webdriver.extensions.settings.T

    Set settings for the current session.

    For more on settings, see: https://github.com/appium/appium/blob/master/docs/en/advanced-concepts/settings.md

    Parameters

      settings – dictionary of settings to apply to the current test session

## Module contents