Skip to main content

Appium Python Client Moneky

Hot Patch For Appium-Python-Client

PyPI version Downloads

An extension library for adding WebDriver Protocol and Appium commands to the Selenium Python language binding for use with the mobile testing framework Appium.

Notice

Since Appium_Python-Client v1.0.0, only Python 3.7+ is supported.

Since Appium_Python-Client v2.0.0, the base selenium client version is v4. The version only works in W3C WebDriver protocol format. If you would like to use the old protocol (MJSONWP), please use v1 Appium Python client. More Reference

Getting the Appium Python client Monkey

There are three ways to install and use the Appium Python client.

  1. Install from PyPi, as 'Appium-Python-Client-Monkey'.

    pip install Appium-Python-Client-Monkey
    

    You can see the history from here

  2. Install from source, via PyPi. From 'Appium-Python-Client', download and unarchive the source tarball (Appium-Python-Client-Monkey-X.X.tar.gz).

    tar -xvf  Appium-Python-Client-Monkey-X.X.tar.gz
    cd Appium-Python-Client-Monkey-X.X
    python setup.py install
    
  3. Install from source via GitHub.

    git clone git@github.com:CN-Robert-LIU/appium-python-client-monkey.git
    cd appium-python-client-monkey
    python setup.py install
    

Usage

The Appium Python Client is fully compliant with the WebDriver Protocol including several helpers to make mobile testing in Python easier.

To use the new functionality now, and to use the superset of functions, instead of including the Selenium webdriver module in your test code, use that from Appium instead.

from appium import webdriver

from appium_patch import monkey
webdriver.Remote = monkey.patch_all()

From there much of your test code will work with no change.

As a base for the following code examples, the following sets up the UnitTest environment:

# Android environment
import unittest
from appium import webdriver
from appium_patch import monkey
webdriver.Remote = monkey.patch_all()


desired_caps = dict(
    platformName='Android',
    platformVersion='10',
    automationName='uiautomator2',
    deviceName='Android Emulator',
    app=PATH('../../../apps/selendroid-test-app.apk')
)
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
el = self.driver.find_element_by_accessibility_id('item')
el.click()
# iOS environment
import unittest
from appium import webdriver
from appium_patch import monkey
webdriver.Remote = monkey.patch_all()


desired_caps = dict(
    platformName='iOS',
    platformVersion='13.4',
    automationName='xcuitest',
    deviceName='iPhone Simulator',
    app=PATH('../../apps/UICatalog.app.zip')
)

self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
el = self.driver.find_element_by_accessibility_id('item')
el.click()

Direct Connect URLs

If your Selenium/Appium server decorates the new session capabilities response with the following keys:

  • directConnectProtocol
  • directConnectHost
  • directConnectPort
  • directConnectPath

Then python client will switch its endpoint to the one specified by the values of those keys.

import unittest
from appium import webdriver
from appium_patch import monkey
webdriver.Remote = monkey.patch_all()


desired_caps = dict(
    platformName='iOS',
    platformVersion='13.4',
    automationName='xcuitest',
    deviceName='iPhone Simulator',
    app=PATH('../../apps/UICatalog.app.zip')
)

self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, direct_connection=True)

Relax SSL validation

strict_ssl option allows you to send commands to an invalid certificate host like a self-signed one.

import unittest
from appium import webdriver
from appium_patch import monkey
webdriver.Remote = monkey.patch_all()


desired_caps = dict(
    platformName='iOS',
    platformVersion='13.4',
    automationName='xcuitest',
    deviceName='iPhone Simulator',
    app=PATH('../../apps/UICatalog.app.zip')
)

self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps, strict_ssl=False)

License

Apache License v2

Release files for Appium-Python-Client-Monkey 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Appium-Python-Client-Monkey 1.0.0
File Size Uploaded
Appium-Python-Client-Monkey-1.0.0.tar.gz 5.4 kB Details

Release files / Appium-Python-Client-Monkey-1.0.0.tar.gz

Download URL Appium-Python-Client-Monkey-1.0.0.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f024ef1d7ddb69c171f5650770e4d785388060165c1b12e48d4c71d3bf6a1c2e
BLAKE2b-256 checksum
How to use checksums
c80544254a5a15aaba5c49a00f4d9acf37eca78028a8c48aad83ba778c01091c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.4.2 requests/2.26.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.62.3 CPython/3.8.10

Release history Release notifications | RSS feed

This release

1.0.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page