Python 脚本如下:操作微信登录键
from appium import webdriver
import time
desired_caps = {}
# 获取操作平台
desired_caps['platformName'] = 'Android'
#desired_caps['platformVersion'] = '4.4.2'
# 获取设备名
desired_caps['deviceName'] = '127.0.0.1:62001'
# 获取包名
desired_caps['appPackage'] = 'com.tencent.mm'
# 获取活动名
desired_caps['appActivity'] = '.plugin.account.ui.WelcomeActivity'
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
try:
element = driver.find_element_by_id('com.tencent.mm:id/f34')
# 如果找到该 id 所指定控件,则进行点击操作
element.click()
except:
print "exist"
pass
time.sleep(2)
# 断开连接
driver.quit()
报错信息如下:
Message: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command 'D:\MyProjectApplication\Android\android-sdk\platform-tools\adb.exe -P 5037 -s 127.0.0.1:62001 push 'C:\Program Files\Appium\resources\app\node_modules\appium\node_modules\io.appium.settings\apks\settings_apk-debug.apk' /data/local/tmp/appium_cache/3d97225b036c28750562ef8962defee6b1af19a4.apk' timed out after 60000ms'. Try to increase the 60000ms adb execution timeout represented by 'adbExecTimeout' capability