from appium import webdriver
from appium.options.common import AppiumOptions
# 定义连接的字典
desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['platformVersion'] = '6.0'
desired_caps['deviceName'] = 'name'
desired_caps['appPackage'] = 'com.android.settings'
desired_caps['appActivity'] = 'com.android.settings.Settings'
# 实例化AppiumOptions对象
options = AppiumOptions().load_capabilities(desired_caps)
# 进行服务启动
driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', options=options)
print("启动【设置】应用")
driver.quit()
注意:
然后库是新的的话 使用
from appium.options.common import AppiumOptions
# 定义连接的字典
caps = {}
....
# 实例化 AppiumOptions 对象
options = AppiumOptions().load_capabilities(caps)
# 进行服务启动
driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", options=options)
appium 版本:1.19.1
mumu模拟器:MuMuInstaller_1.5.0.7_v2.7.34.0x64_zh-Hans_1692065501
appium python client: 3.1.0
adb:
Android Debug Bridge version 1.0.41
Version 31.0.2-7242960