webdriver.appium_connection.AppiumConnection(remote_server_addr, keep_alive=False, resolve_ip=True)¶Bases: selenium.webdriver.remote.remote_connection.RemoteConnection
get_remote_connection_headers(parsed_url: str, keep_alive: bool = True) → Dict[str, Any]¶Override get_remote_connection_headers in RemoteConnection
webdriver.appium_service.AppiumService¶Bases: object
is_listening¶Check if the service is listening on the given/default host/port.
The fact, that the service is running, does not always mean it is listening. the default host/port values can be customized by providing –address/–port command line arguments while starting the service.
True if the service is running and listening on the given/default host/port
bool
is_running¶Check if the service is running.
True or False
bool
start(**kwargs: Any) → subprocess.Popen¶Starts Appium service with given arguments.
The service will be forcefully restarted if it is already running.
env (dict) – Environment variables mapping. The default system environment, which is inherited from the parent process is assigned by default.
node (str) – The full path to the main NodeJS executable. The service will try to retrieve it automatically by default.
stdout – Check on the documentation for subprocess.Popen for more details. The default value is subprocess.PIPE.
stderr – Check on the documentation for subprocess.Popen for more details. The default value is subprocess.PIPE.
timeout_ms (int) – The maximum time to wait until Appium process starts listening for HTTP connections. If set to zero or a negative number then no wait will be applied. 60000 ms by default
main_script (str) – The full path to the main Appium executable (usually located this is build/lib/main.js). If this is not set then the service tries to detect the path automatically.
args (str) – List of Appium arguments (all must be strings). Check on https://appium.io/docs/en/writing-running-appium/server-args/ for more details about possible arguments and their values.
or stderr/stdout properties of the instance (stdout/stderr must not be set to None in such case) in order to retrieve the actual process output.
subprocess.Popen instance
stop() → bool¶Stops Appium service if it is running.
The call will be ignored if the service is not running or has been already stopped.
True if the service was running before being stopped
bool
webdriver.appium_service.AppiumServiceError¶Bases: RuntimeError
webdriver.appium_service.find_executable(executable: str) → Optional[str]¶webdriver.appium_service.poll_url(host: str, port: int, path: str, timeout_ms: int) → bool¶https://code.google.com/p/selenium/source/browse/spec-draft.md?repo=mobile#120
Value (Alias) |
Data |
Wifi |
Airplane Mode |
|---|---|---|---|
0 (None) |
0 |
0 |
0 |
1 (Airplane Mode) |
0 |
0 |
1 |
2 (Wifi only) |
0 |
1 |
0 |
4 (Data only) |
1 |
0 |
0 |
6 (All network on) |
1 |
1 |
0 |
webdriver.errorhandler.MobileErrorHandler¶Bases: selenium.webdriver.remote.errorhandler.ErrorHandler
check_response(response: Dict) → None¶Checks that a JSON response from the WebDriver does not have an error.
response - The JSON response from the WebDriver server as a dictionary object.
If the response contains an error message.
webdriver.mobilecommand.MobileCommand¶Bases: object
ACTIVATE_APP = 'activateApp'¶ACTIVATE_IME_ENGINE = 'activateIMEEngine'¶BACKGROUND = 'background'¶CLEAR = 'clear'¶CLOSE_APP = 'closeApp'¶COMPARE_IMAGES = 'compareImages'¶CONTEXTS = 'getContexts'¶DEACTIVATE_IME_ENGINE = 'deactivateIMEEngine'¶END_TEST_COVERAGE = 'endTestCoverage'¶EXECUTE_DRIVER = 'executeDriver'¶FINGER_PRINT = 'fingerPrint'¶GET_ACTIVE_IME_ENGINE = 'getActiveEngine'¶GET_ALL_SESSIONS = 'getAllSessions'¶GET_APP_STRINGS = 'getAppStrings'¶GET_AVAILABLE_IME_ENGINES = 'getAvailableIMEEngines'¶GET_CLIPBOARD = 'getClipboard'¶GET_CURRENT_ACTIVITY = 'getCurrentActivity'¶GET_CURRENT_CONTEXT = 'getCurrentContext'¶GET_CURRENT_PACKAGE = 'getCurrentPackage'¶GET_DEVICE_TIME_GET = 'getDeviceTimeGet'¶GET_DEVICE_TIME_POST = 'getDeviceTimePost'¶GET_DISPLAY_DENSITY = 'getDisplayDensity'¶GET_EVENTS = 'getLogEvents'¶GET_LOCATION = 'getLocation'¶GET_NETWORK_CONNECTION = 'getNetworkConnection'¶GET_PERFORMANCE_DATA = 'getPerformanceData'¶GET_PERFORMANCE_DATA_TYPES = 'getPerformanceDataTypes'¶GET_SESSION = 'getSession'¶GET_SETTINGS = 'getSettings'¶GET_SYSTEM_BARS = 'getSystemBars'¶HIDE_KEYBOARD = 'hideKeyboard'¶INSTALL_APP = 'installApp'¶IS_APP_INSTALLED = 'isAppInstalled'¶IS_IME_ACTIVE = 'isIMEActive'¶IS_KEYBOARD_SHOWN = 'isKeyboardShown'¶IS_LOCKED = 'isLocked'¶KEY_EVENT = 'keyEvent'¶LAUNCH_APP = 'launchApp'¶LOCATION_IN_VIEW = 'locationInView'¶LOCK = 'lock'¶LOG_EVENT = 'logCustomEvent'¶LONG_PRESS_KEYCODE = 'longPressKeyCode'¶MAKE_GSM_CALL = 'makeGsmCall'¶MULTI_ACTION = 'multiAction'¶OPEN_NOTIFICATIONS = 'openNotifications'¶PRESS_KEYCODE = 'pressKeyCode'¶PULL_FILE = 'pullFile'¶PULL_FOLDER = 'pullFolder'¶PUSH_FILE = 'pushFile'¶QUERY_APP_STATE = 'queryAppState'¶REMOVE_APP = 'removeApp'¶REPLACE_KEYS = 'replaceKeys'¶RESET = 'reset'¶SEND_SMS = 'sendSms'¶SET_CLIPBOARD = 'setClipboard'¶SET_GSM_SIGNAL = 'setGsmSignal'¶SET_GSM_VOICE = 'setGsmVoice'¶SET_IMMEDIATE_VALUE = 'setImmediateValue'¶SET_LOCATION = 'setLocation'¶SET_NETWORK_CONNECTION = 'setNetworkConnection'¶SET_NETWORK_SPEED = 'setNetworkSpeed'¶SET_POWER_AC = 'setPowerAc'¶SET_POWER_CAPACITY = 'setPowerCapacity'¶SHAKE = 'shake'¶START_ACTIVITY = 'startActivity'¶START_RECORDING_SCREEN = 'startRecordingScreen'¶STOP_RECORDING_SCREEN = 'stopRecordingScreen'¶SWITCH_TO_CONTEXT = 'switchToContext'¶TERMINATE_APP = 'terminateApp'¶TOGGLE_LOCATION_SERVICES = 'toggleLocationServices'¶TOGGLE_TOUCH_ID_ENROLLMENT = 'toggleTouchIdEnrollment'¶TOGGLE_WIFI = 'toggleWiFi'¶TOUCH_ACTION = 'touchAction'¶TOUCH_ID = 'touchId'¶UNLOCK = 'unlock'¶UPDATE_SETTINGS = 'updateSettings'¶webdriver.webdriver.WebDriver(command_executor: str = 'http://127.0.0.1:4444/wd/hub', desired_capabilities: Optional[Dict] = None, browser_profile: str = None, proxy: str = None, keep_alive: bool = True, direct_connection: bool = False)¶Bases: webdriver.extensions.search_context.AppiumSearchContext, webdriver.extensions.action_helpers.ActionHelpers, webdriver.extensions.android.activities.Activities, webdriver.extensions.applications.Applications, webdriver.extensions.clipboard.Clipboard, webdriver.extensions.context.Context, webdriver.extensions.android.common.Common, webdriver.extensions.device_time.DeviceTime, webdriver.extensions.android.display.Display, webdriver.extensions.execute_driver.ExecuteDriver, webdriver.extensions.execute_mobile_command.ExecuteMobileCommand, webdriver.extensions.android.gsm.Gsm, webdriver.extensions.hw_actions.HardwareActions, webdriver.extensions.images_comparison.ImagesComparison, webdriver.extensions.ime.IME, webdriver.extensions.keyboard.Keyboard, webdriver.extensions.location.Location, webdriver.extensions.log_event.LogEvent, webdriver.extensions.android.network.Network, webdriver.extensions.android.performance.Performance, webdriver.extensions.android.power.Power, webdriver.extensions.remote_fs.RemoteFS, webdriver.extensions.screen_record.ScreenRecord, webdriver.extensions.session.Session, webdriver.extensions.settings.Settings, webdriver.extensions.android.sms.Sms, webdriver.extensions.android.system_bars.SystemBars
create_web_element(element_id: int, w3c: bool = False) → webdriver.webelement.WebElement¶Creates a web element with the specified element_id.
Overrides method in Selenium WebDriver in order to always give them Appium WebElement
element_id (int) – The element id to create a web element
w3c (bool) – Whether the element is W3C or MJSONWP
MobileWebElement
find_element(by: str = 'id', value: Union[str, Dict] = None) → webdriver.webelement.WebElement¶‘Private’ method used by the find_element_by_* methods.
Override for Appium
Use the corresponding find_element_by_* instead of this.
appium.webdriver.webelement.WebElement
MobileWebElement
find_elements(by: str = 'id', value: Union[str, Dict] = None) → Union[List[webdriver.webelement.WebElement], List]¶‘Private’ method used by the find_elements_by_* methods.
Override for Appium
Use the corresponding find_elements_by_* instead of this.
list of appium.webdriver.webelement.WebElement
list of MobileWebElement
set_value(element: webdriver.webelement.WebElement, value: str) → T¶Set the value on an element in the application.
(appium.webdriver.webelement.WebElement (element) – the element whose value will be set
value (str) – the value to set on the element
appium.webdriver.webdriver.WebDriver
start_session(capabilities: Dict, browser_profile: Optional[str] = None) → None¶Creates a new session with the desired capabilities.
Override for Appium
automation_name – The name of automation engine to use.
platform_name – The name of target platform.
platform_version – The kind of mobile device or emulator to use
app – The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these.
Read https://github.com/appium/appium/blob/master/docs/en/writing-running-appium/caps.md for more details.
webdriver.webelement.WebElement(parent, id_, w3c=False)¶Bases: webdriver.extensions.search_context.AppiumWebElementSearchContext
clear() → T¶Clears text.
Override for Appium
appium.webdriver.webelement.WebElement
find_element(by: str = 'id', value: Union[str, Dict] = None) → T¶Find an element given a By strategy and locator
Override for Appium
Prefer the find_element_by_* methods when possible.
by (str, optional) – The strategy
value (str, optional) – The locator
element = element.find_element(By.ID, ‘foo’)
appium.webdriver.webelement.WebElement
find_elements(by: str = 'id', value: Union[str, Dict] = None) → List[T]¶Find elements given a By strategy and locator
Override for Appium
Prefer the find_elements_by_* methods when possible.
by (str, optional) – The strategy
value (str, optional) – The locator
element = element.find_elements(By.CLASS_NAME, ‘foo’)
list of appium.webdriver.webelement.WebElement
get_attribute(name: str) → Optional[str]¶Gets the given attribute or property of the element.
Override for Appium
This method will first try to return the value of a property with the
given name. If a property with that name doesn’t exist, it returns the
value of the attribute with the same name. If there’s no attribute with
that name, None is returned.
Values which are considered truthy, that is equals “true” or “false”,
are returned as booleans. All other non-None values are returned
as strings. For attributes or properties which do not exist, None
is returned.
name (str) – Name of the attribute/property to retrieve.
# Check if the “active” CSS class is applied to an element. is_active = “active” in target_element.get_attribute(“class”)
The given attribute or property of the element
str
is_displayed() → bool¶Whether the element is visible to a user.
Override for Appium
location_in_view¶Gets the location of an element relative to the view.
location = element.location_in_view
x = location[‘x’]
y = location[‘y’]
The location of an element relative to the view
dict
set_text(keys: str = '') → T¶Sends text to the element.
Previous text is removed. Android only.
keys (str) – the text to be sent to the element.
element.set_text(‘some text’)
appium.webdriver.webelement.WebElement
set_value(value: str) → T¶Set the value on this element in the application
value (str) – The value to be set
appium.webdriver.webelement.WebElement
Appium Python Client: WebDriver module