webdriver.extensions package¶
Subpackages¶
- webdriver.extensions.android package
- Submodules
- webdriver.extensions.android.activities module
- webdriver.extensions.android.common module
- webdriver.extensions.android.display module
- webdriver.extensions.android.gsm module
- webdriver.extensions.android.nativekey module
- webdriver.extensions.android.network module
- webdriver.extensions.android.performance module
- webdriver.extensions.android.power module
- webdriver.extensions.android.sms module
- webdriver.extensions.android.system_bars module
- Module contents
- webdriver.extensions.search_context package
- Submodules
- webdriver.extensions.search_context.android module
- webdriver.extensions.search_context.base_search_context module
- webdriver.extensions.search_context.custom module
- webdriver.extensions.search_context.ios module
- webdriver.extensions.search_context.mobile module
- webdriver.extensions.search_context.windows module
- Module contents
Submodules¶
webdriver.extensions.action_helpers module¶
-
class
webdriver.extensions.action_helpers.
ActionHelpers
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
drag_and_drop
(origin_el: appium.webdriver.webelement.WebElement, destination_el: appium.webdriver.webelement.WebElement) → T¶ Drag the origin element to the destination element
- Parameters
originEl (appium.webdriver.webelement.WebElement) – the element to drag
destinationEl (appium.webdriver.webelement.WebElement) – the element to drag to
- Returns
appium.webdriver.webelement.WebElement
-
flick
(start_x: int, start_y: int, end_x: int, end_y: int) → T¶ Flick from one point to another point.
- Parameters
start_x (int) – x-coordinate at which to start
start_y (int) – y-coordinate at which to start
end_x (int) – x-coordinate at which to stop
end_y (int) – y-coordinate at which to stop
- Usage:
driver.flick(100, 100, 100, 400)
- Returns
appium.webdriver.webelement.WebElement
-
scroll
(origin_el: appium.webdriver.webelement.WebElement, destination_el: appium.webdriver.webelement.WebElement, duration: Optional[int] = None) → T¶ Scrolls from one element to another
- Parameters
originalEl (appium.webdriver.webelement.WebElement) – the element from which to being scrolling
destinationEl (appium.webdriver.webelement.WebElement) – the element to scroll to
duration (int) – a duration after pressing originalEl and move the element to destinationEl. Default is 600 ms for W3C spec. Zero for MJSONWP.
- Usage:
driver.scroll(el1, el2)
- Returns
appium.webdriver.webelement.WebElement
-
swipe
(start_x: int, start_y: int, end_x: int, end_y: int, duration: int = 0) → T¶ Swipe from one point to another point, for an optional duration.
- Parameters
start_x (int) – x-coordinate at which to start
start_y (int) – y-coordinate at which to start
end_x (int) – x-coordinate at which to stop
end_y (int) – y-coordinate at which to stop
duration (
int
, optional) – time to take the swipe, in ms.
- Usage:
driver.swipe(100, 100, 100, 400)
- Returns
appium.webdriver.webelement.WebElement
-
tap
(positions: List[Tuple[int, int]], duration: Optional[int] = None) → T¶ Taps on an particular place with up to five fingers, holding for a certain time
- Parameters
positions (
list
oftuple
) – an array of tuples representing the x/y coordinates of the fingers to tap. Length can be up to five.duration (
int
, optional) – length of time to tap, in ms
- Usage:
driver.tap([(100, 20), (100, 60), (100, 100)], 500)
- Returns
appium.webdriver.webelement.WebElement
-
webdriver.extensions.applications module¶
-
class
webdriver.extensions.applications.
Applications
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
activate_app
(app_id: str) → T¶ Activates the application if it is not running or is running in the background.
- Parameters
app_id (str) – the application id to be activated
- Returns
appium.webdriver.webdriver.WebDriver
-
app_strings
(language: str = None, string_file: str = None) → Dict[str, str]¶ Returns the application strings from the device for the specified language.
- Parameters
language (str) – strings language code
string_file (str) – the name of the string file to query
- Returns
The key is string id and the value is the content.
- Return type
Dict[str, str]
-
background_app
(seconds: int) → T¶ Puts the application in the background on the device for a certain duration.
- Parameters
seconds (int) – the duration for the application to remain in the background
- Returns
appium.webdriver.webdriver.WebDriver
-
close_app
() → T¶ Stop the running application, specified in the desired capabilities, on the device.
- Returns
appium.webdriver.webdriver.WebDriver
-
install_app
(app_path: str, **options: Any) → T¶ Install the application found at app_path on the device.
- Parameters
app_path (str) – 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
appium.webdriver.webdriver.WebDriver
-
is_app_installed
(bundle_id: str) → bool¶ Checks whether the application specified by bundle_id is installed on the device.
- Parameters
bundle_id (str) – the id of the application to query
- Returns
True if app is installed
- Return type
bool
-
launch_app
() → T¶ Start on the device the application specified in the desired capabilities.
- Returns
appium.webdriver.webdriver.WebDriver
-
query_app_state
(app_id: str) → int¶ Queries the state of the application.
- Parameters
app_id (str) – 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) → T¶ Remove the specified application from the device.
- Parameters
app_id (str) – 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
appium.webdriver.webdriver.WebDriver
-
reset
() → T¶ Resets the current application on the device.
-
terminate_app
(app_id: str, **options: Any) → bool¶ Terminates the application if it is running.
- Parameters
app_id (str) – 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
- Return type
bool
-
webdriver.extensions.clipboard module¶
-
class
webdriver.extensions.clipboard.
Clipboard
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
get_clipboard
(content_type: str = 'plaintext') → bytes¶ Receives the content of the system clipboard
- Parameters
content_type (str) – 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
- Return type
str
-
set_clipboard
(content: bytes, content_type: str = 'plaintext', label: Optional[str] = None) → T¶ Set the content of the system clipboard
- Parameters
content (bytes) – The content to be set as bytearray string
content_type (str) – One of ClipboardContentType items. Only ClipboardContentType.PLAINTEXT is supported on Android
label (
str
, optional) – label argument, which only works for Android
- Returns
appium.webdriver.webdriver.WebDriver
-
set_clipboard_text
(text: str, label: Optional[str] = None) → T¶ Copies the given text to the system clipboard
- Parameters
text (str) – The text to be set
label (
str
, optional) – label argument, which only works for Android
- Returns
appium.webdriver.webdriver.WebDriver
-
webdriver.extensions.context module¶
-
class
webdriver.extensions.context.
Context
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
property
context
¶ Returns the current context of the current session.
- Usage:
driver.context
- Returns
The context of the current session
- Return type
str
-
property
contexts
¶ Returns the contexts within the current session.
- Usage:
driver.contexts
- Returns
The contexts within the current session
- Return type
list
ofstr
-
property
current_context
¶ Returns the current context of the current session.
- Usage:
driver.current_context
- Returns
The context of the current session
- Return type
str
-
property
webdriver.extensions.device_time module¶
-
class
webdriver.extensions.device_time.
DeviceTime
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
property
device_time
¶ 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 (
str
, optional) – The set of format specifiers. Read https://momentjs.com/docs/ to get the full list of supported datetime format specifiers. If unset, returndevice_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
-
property
webdriver.extensions.execute_driver module¶
-
class
webdriver.extensions.execute_driver.
ExecuteDriver
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=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 (str) – The string consisting of the script itself
script_type (str) – The name of the script type. Defaults to ‘webdriverio’.
timeout_ms (
int
, optional) – 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.
-
webdriver.extensions.execute_mobile_command module¶
-
class
webdriver.extensions.execute_mobile_command.
ExecuteMobileCommand
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
property
battery_info
¶ 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
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 (str) – the button name to be sent to the device
- Returns
appium.webdriver.webdriver.WebDriver
-
property
webdriver.extensions.hw_actions module¶
-
class
webdriver.extensions.hw_actions.
HardwareActions
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=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 (int) – 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
- Return type
bool
-
lock
(seconds: Optional[int] = None) → T¶ Lock the device. No changes are made if the device is already unlocked.
- Parameters
seconds (
int
, optional) – 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
appium.webdriver.webdriver.WebDriver
-
shake
() → T¶ Shake the device.
- Returns
appium.webdriver.webdriver.WebDriver
-
toggle_touch_id_enrollment
() → T¶ Toggle enroll touchId on iOS Simulator
- Returns
appium.webdriver.webdriver.WebDriver
-
touch_id
(match: bool) → T¶ Simulate touchId on iOS Simulator
- Parameters
match (bool) – Simulates a successful touch (True) or a failed touch (False)
- Returns
appium.webdriver.webdriver.WebDriver
-
unlock
() → T¶ Unlock the device. No changes are made if the device is already locked.
- Returns
appium.webdriver.webdriver.WebDriver
-
webdriver.extensions.images_comparison module¶
-
class
webdriver.extensions.images_comparison.
ImagesComparison
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=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 (bytes) – base64-encoded content of the full image
base64_partial_image (bytes) – 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 (bytes) – base64-encoded content of the first image
base64_image2 (bytes) – 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. 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 (bytes) – base64-encoded content of the first image
base64_image2 (bytes) – 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
-
webdriver.extensions.ime module¶
-
class
webdriver.extensions.ime.
IME
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
activate_ime_engine
(engine: str) → T¶ Activates the given IME engine on the device.
Android only.
- Parameters
engine (str) – the package and activity of the IME engine to activate (e.g., ‘com.android.inputmethod.latin/.LatinIME’)
- Returns
appium.webdriver.webdriver.WebDriver
-
property
active_ime_engine
¶ 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
¶ 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
ofstr
-
deactivate_ime_engine
() → T¶ Deactivates the currently active IME engine on the device.
Android only.
- Returns
appium.webdriver.webdriver.WebDriver
-
is_ime_active
() → bool¶ Checks whether the device has IME service active. Android only.
- Returns
True if IME service is active
- Return type
bool
-
webdriver.extensions.keyboard module¶
-
class
webdriver.extensions.keyboard.
Keyboard
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
hide_keyboard
(key_name: Optional[str] = None, key: Optional[str] = None, strategy: Optional[str] = None) → 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 (
str
, optional) – key to presskey (
str
, optional) –strategy (
str
, optional) – strategy for closing the keyboard (e.g., tapOutside)
-
is_keyboard_shown
() → bool¶ Attempts to detect whether a software keyboard is present
- Returns
True if keyboard is shown
- Return type
bool
-
keyevent
(keycode: int, metastate: Optional[int] = None) → 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 (int) – the keycode to be sent to the device
metastate (
int
, optional) – meta information about the keycode being sent
- Returns
appium.webdriver.webdriver.WebDriver
-
long_press_keycode
(keycode: int, metastate: Optional[int] = None, flags: Optional[int] = None) → 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 (int) – the keycode to be sent to the device
metastate (
int
, optional) – meta information about the keycode being sentflags (
int
, optional) – the set of key event flags
- Returns
appium.webdriver.webdriver.WebDriver
-
press_keycode
(keycode: int, metastate: Optional[int] = None, flags: Optional[int] = None) → 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 (int) – the keycode to be sent to the device
metastate (
int
, optional) – meta information about the keycode being sentflags (
int
, optional) – the set of key event flags
- Returns
appium.webdriver.webdriver.WebDriver
-
webdriver.extensions.location module¶
-
class
webdriver.extensions.location.
Location
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
property
location
¶ 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: Union[float, str] = None) → T¶ Set the location of the device
- Parameters
latitude (Union[float, str]) – String or numeric value between -90.0 and 90.00
longitude (Union[float, str]) – String or numeric value between -180.0 and 180.0
altitude (Union[float, str], optional) – String or numeric value (Android real device only)
- Returns
appium.webdriver.webdriver.WebDriver
-
toggle_location_services
() → T¶ Toggle the location services on the device.
Android only.
- Returns
appium.webdriver.webdriver.WebDriver
-
property
webdriver.extensions.log_event module¶
-
class
webdriver.extensions.log_event.
LogEvent
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
get_events
(type: List[str] = None) → Dict[str, Union[str, int]]¶ Retrieves events information from the current session (Since Appium 1.16.0)
- Parameters
type (
list
ofstr
) – 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: (str) The command name that has been sent to the appium server startTime: (int) Received time endTime: (int) Response time
- Return type
dict
-
log_event
(vendor: str, event: str) → T¶ Log a custom event on the Appium server. (Since Appium 1.16.0)
- Parameters
vendor (str) – The vendor to log
event (str) – The event to log
- Usage:
driver.log_event(‘appium’, ‘funEvent’)
- Returns
appium.webdriver.webdriver.WebDriver
-
webdriver.extensions.remote_fs module¶
-
class
webdriver.extensions.remote_fs.
RemoteFS
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
pull_file
(path: str) → str¶ Retrieves the file at path.
- Parameters
path (str) – the path to the file on the device
- Returns
The file’s contents encoded as Base64.
- Return type
str
-
pull_folder
(path: str) → str¶ Retrieves a folder at path.
- Parameters
path (str) – the path to the folder on the device
- Returns
The folder’s contents zipped and encoded as Base64.
- Return type
str
-
push_file
(destination_path: str, base64data: Optional[str] = None, source_path: Optional[str] = None) → 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 (str) – the location on the device/simulator where the local file contents should be saved
base64data (
str
, optional) – file contents, encoded as Base64, to be written to the file on the device/simulatorsource_path (
str
, optional) – local file path for the file to be loaded on device
- Returns
appium.webdriver.webdriver.WebDriver
-
webdriver.extensions.screen_record module¶
-
class
webdriver.extensions.screen_record.
ScreenRecord
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
start_recording_screen
(**options: Any) → Union[bytes, str]¶ Start asynchronous screen recording process.
- 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 maximum value for Android is 3 minutes. The maximum value for iOS is 10 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.
bugReport (str) – 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).
videoQuality (str) – [iOS only] The video encoding quality: ‘low’, ‘medium’, ‘high’, ‘photo’. Defaults to ‘medium’.
videoType (str) – [iOS only] 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 only] 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 only] 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 only] 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 only] 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 only] 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 only] 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.
- 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.
- 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
-
webdriver.extensions.session module¶
-
class
webdriver.extensions.session.
Session
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=None)¶ Bases:
selenium.webdriver.remote.webdriver.WebDriver
-
property
all_sessions
¶ Retrieves all sessions that are open
- Usage:
sessions = driver.all_sessions
- Returns
containing all open sessions
- Return type
list
ofdict
-
property
events
¶ 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
¶ Retrieves session information from the current session
- Usage:
session = driver.session
- Returns
containing information from the current session
- Return type
dict
-
property
webdriver.extensions.settings module¶
-
class
webdriver.extensions.settings.
Settings
(command_executor='http://127.0.0.1:4444/wd/hub', desired_capabilities=None, browser_profile=None, proxy=None, keep_alive=False, file_detector=None, options=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
- Return type
dict
-
update_settings
(settings: Dict[str, Any]) → 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 (dict) – dictionary of settings to apply to the current test session
-