使用python-appium-client驱动夜神模拟器
1、打开appium服务端,启动appium server
2、打开夜神模拟器,模拟器上安装新浪微博
3、pycharm安装python-appium-client
4、模拟器打开应用,cmd输入adb shell dumpsys window | findstr mCurrentFocus获取packge name和activity name
5、新建python file输入代码,根据实际情况填写数据
from appium import webdriver
import time
desired_caps = {
'platformName':'Android',
'platformVersion':'5.1.1',
'deviceName':'127.0.0.1:62001',
'appPackage': 'com.sina.weibo',
'appActivity': 'com.sina.weibo.account.login.LoginActivity',
'noreset':'true'
}
driver1=webdriver.Remote('http://localhost:4723/wd/hub',desired_caps)
time.sleep(20)
driver1.find_element_by_id('com.sina.weibo:id/et_phone').send_keys('1821231233')
运行结果