一、拷贝出极简脚本
上节中我们就附录了极简脚本(此处楼主选择的是python语言),如下:
# This sample code uses the Appium python client
# pip install Appium-Python-Client
# Then you can paste this into a file and simply run with Python
from appium import webdriver
caps = {}
caps["platformName"] = "Android"
caps["platformVersion"] = "4.4"
caps["deviceName"] = "xxxxxxxxxxxx"
caps["noReset"] = True
caps["udid"] = "xxxxxxxxxxxxxxx"
caps["appPackage"] = "com.tencent.mobileqq"
caps["appActivity"] = ".activity.SplashActivity"
caps["autoGrantPermissions"] = True
caps["exported"] = True
caps["unicodeKeyboard"] = True
caps["resetKeyboard"] = True
driver = webdriver.Remote("http://localhost:4723/wd/hub", caps)
driver.quit()
那么如何在python中运行脚本呢?
二、安装Appium-Python-Client
cmd进入python的scripts目录下
pip install Appium-Python-Client
三、运行脚本
在保证appium-desktop服务开启的情况下,IDLE运行极简脚本,就会看到自动打开指定的APP界面咯!
image.png