源码
连接的是模拟器
import time
from appium import webdriver
from selenium.webdriver.common.by import By
capabilities = {}
capabilities['platformName'] = 'Android'
capabilities['deviceName'] = 'WTK7N17112004938'
capabilities['noRest'] = 'true'
capabilities['platformVersion'] = '5.1.1'
capabilities['app'] = 'C:\\Users\\beix\\Desktop\\A_0712.apk'
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', capabilities)
#capabilities['appWaiteActivity'] = 'com.XXX.mall.activity.WelcomeActivity'
size = driver.get_window_size()
x = size['width']
y = size['height']
time.sleep(2)
driver.swipe(3*x/4, y/2, x/4, y/2, 400)
driver.find_elements_by_id('com.XXX.XXX:id/tv_tab_title')[4].click()
driver.find_element_by_id('com.XXX.XXX:id/et_phone').send_keys('XXX')
driver.find_element_by_id('com.XXX.XXX:id/et_valikey').send_keys('XXX')
driver.find_element_by_id('com.XXX.XXX:id/tv_login').click()