Last active
October 4, 2019 17:26
-
-
Save MLKrisJohnson/7c8ce317053a0054e012ab045aa972ee to your computer and use it in GitHub Desktop.
A very simple Appium test script for an iOS device
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Simple Appium script that connects to an iOS device and prints the page source. | |
# | |
# Requires Python 3.x | |
# | |
# Run 'pip3 install Appium-Python-Client' to install dependencies | |
# Set these variables as appropriate for the device and app you want to launch | |
# Path to application package | |
APPIUM_APP='./apps/MyApplication.ipa' | |
# Device identification | |
APPIUM_DEVICE_NAME='KJ iPhone 6' | |
APPIUM_UDID='934d602e1b71517d368b59032522a1d563bc1e91' | |
APPIUM_PLATFORM_VERSION='12.4.1' | |
import datetime | |
from appium import webdriver | |
# Appium server URL | |
url='http://127.0.0.1:4723/wd/hub' | |
# Appium parameters | |
capabilities = { | |
'app' : APPIUM_APP, | |
'deviceName' : APPIUM_DEVICE_NAME, | |
'udid' : APPIUM_UDID, | |
'platformVersion' : APPIUM_PLATFORM_VERSION, | |
'platformName' : 'iOS', | |
'automationName' : 'xcuitest', | |
'noReset' : 'false', | |
'fullReset' : 'true', | |
} | |
print(f'TEST START: {datetime.datetime.now()}') | |
# Connect to Appium server and launch the app | |
driver = webdriver.Remote(url, capabilities) | |
# Get current page source | |
source = driver.page_source | |
print(f'PAGE SOURCE:\n{source}') | |
# Finished | |
print(f'TEST FINISH: {datetime.datetime.now()}') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment