AttributeError: 'NoneType' object has no attribute 'to_capabilities'
初始化参数配置:
desired_caps = {
"platformName": "Android",
"platformVersion": "13",
"deviceName": "feheuc9xdypvt8oj",
"appPackage": "tv.danmaku.bili",
"appActivity": ".MainActivityV2",
"unicodeKeyboard": true,
"resetKeyboard": true,
"noReset": true,
"automationName": "UiAutomator2"
}
就可以发送请求了(
导包: from appium import webdriver
),
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
在Appium-Python-Client(清华源为appium-python-client)版本为4.0.0和selenium版本为4.21.0那么会报错“AttributeError: 'NoneType' object has no attribute 'to_capabilities'”【这是错误的最后一行,看错误从最后开始向前看】,但是代码是没有问题的,对于初学者来说就慌了,如何拼命查看代码,修改代码,结果还是一样报一样的错。
其实这个错Appium-Python-Client版本过高导致的,把Appium-Python-Client版本改为2.11.0就解决了