Skip to main content

Hot Patch For Appium-Pyhton-Client

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Appium-Python-Client-Monkey-1.0.0.tar.gz (5.4 kB view details)

Uploaded Source

File details

Details for the file Appium-Python-Client-Monkey-1.0.0.tar.gz.

File metadata

  • Download URL: Appium-Python-Client-Monkey-1.0.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for Appium-Python-Client-Monkey-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f024ef1d7ddb69c171f5650770e4d785388060165c1b12e48d4c71d3bf6a1c2e
MD5 cd57ad5bfbdf2f46cba9e10766944dd9
BLAKE2b-256 c80544254a5a15aaba5c49a00f4d9acf37eca78028a8c48aad83ba778c01091c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page