1、打开微信调试模式
点击连接:http://debugmm.qq.com/?forcex5=ture
进入:http://debugx5.qq.com
打开:
2、启动参数配置
desired_cap = {
"platformName": "Android", # 手机系统
"platformVersion": "9", # 系统版本
"deviceName": 'HUAWEI', # 手机的名称
"appPackage": "com.tencent.mm", # app的包名
"appActivity": "com.tencent.mm.ui.LauncherUI", # app的启动页面
"noReset": True,
# 指定chromedriver驱动
"chromedriverExecutable": "C:\\ChromeDriver\\77\\chromedriver.exe",
# 微信小程序添加参数
"recreateChromeDriverSessions": True,
"unicodeKeyboard": True,
# 指定小程序的进程名
"chromeOptions": {"androidProcess": "com.tencent.mm:appbrand0"}
}
# 启动应用
driver = Remote(command_executor='http://127.0.0.1:4723/wd/hub',
desired_capabilities=desired_cap)
获取小程序进程名称: