雪球app:雪球官方新版本-安卓iOS版下载-应用宝官网
samplecode:https://github.com/appium/sample-code
caps: https://github.com/appium/appium/blob/master/docs/cn/writing-running-appium/caps.md
server-args: https://github.com/appium/appium/blob/master/docs/cn/writing-running-appium/server-args.md
uiautmator-selector-api: https://developer.android.com/reference/android/support/test/uiautomator/UiSelector
python-client: https://github.com/appium/python-client
git clone https://github.com/appium/sample-code.git
import os
import unittest
from appium import webdriver
from time import sleep
# Returns abs path relative to this file and not cwd
PATH = lambda p: os.path.abspath(
os.path.join(os.path.dirname(__file__), p)
)
class ContactsAndroidTests(unittest.TestCase):
def setUp(self):
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '4.2'
desired_caps['deviceName'] = 'Android Emulator'
desired_caps['app'] = PATH(
'../../../sample-code/apps/ContactManager/ContactManager.apk'
)
desired_caps['appPackage'] = 'com.example.android.contactmanager'
desired_caps['appActivity'] = '.ContactManager'
desired_caps['unicodeKeyboard'] = 'true'
# desired_caps['udid'] = 'SJE5T17615004002'
self.driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
def tearDown(self):
self.driver.quit()
def test_add_contacts(self):
el = self.driver.find_element_by_id('com.example.android.contactmanager:id/addContactButton')
el.click()
sleep(5)
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(ContactsAndroidTests)
unittest.TextTestRunner(verbosity=2).run(suite)