使用 python 启动 Android 应用程序的示例代码,一直报异常,怎么解决?

使用python启动Android应用程序的示例代码,执行一直报:Traceback (most recent call last):
File "D:\PyCharmAuto_workstation\appium_test\examples\使用python启动Android应用程序的示例代码.py", line 22, in
driver = webdriver.Remote(server_url, desired_caps)
File "D:\python39\lib\site-packages\appium\webdriver\webdriver.py", line 227, in init
super().init(
File "D:\python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 218, in init
capabilities = options.to_capabilities()
AttributeError: 'NoneType' object has no attribute 'to_capabilities'

Appium-Python-Client 4.4.0 4.4.0
selenium 4.27.1
import time
from appium import webdriver

# 设备的Desired Capabilities设置
desired_caps = {
    "platformName": "Android",
    "deviceName": "88Y5T19912029639",
    # "platformVersion": "14",
    "appPackage": "com.czur.scanpro",
    "appActivity": "com.czur.scanpro/com.czur.scanpro.ui.base.IndexActivity"
}

# Appium服务器地址
server_url = "http://127.0.0.1:4723/wd/hub"
# 启动Appium驱动并连接到设备
driver = webdriver.Remote(server_url, desired_caps)
# 等待一段时间,以便应用程序完全启动
time.sleep(5)
  • 待分类
    9720 引用 • 914 回帖 • 5 关注
  • Q&A
    764 引用 • 583 回帖 • 2 关注
回帖
请输入回帖内容 ...