AttributeError: ‘NoneType‘ object has no attribute ‘to_capabilities‘

运行下面这段代码时报错no attribute 'to_capabilities'这是为Appium-Python-Client3.0和Selenium版本不兼容不建议使用最新版本!

一、报错场景

代码:

from appium import webdriver


desire_cap = {
    "platformName": "Android",
    "deviceName": "127.0.0.1:16384",
    "appPackage": "com.xueqiu.android",
    "appActivity": ".view.WelcomeActivityAlias",
    "noRest": "True"
}

driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desire_cap)
driver.implicitly_wait(10)

 报错信息:

Traceback (most recent call last):
  File "E:\python\pycharm\pythonProject\pytestdemo\appiumTest\appiumdemo.py", line 16, in
    driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub", desire_cap)
  File "E:\python\pycharm\pythonProject\pytestdemo\venv\lib\site-packages\appium\webdriver\webdriver.py", line 229, in __init__
    super().__init__(
  File "E:\python\pycharm\pythonProject\pytestdemo\venv\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 185, in __init__
    capabilities = options.to_capabilities()
AttributeError: 'NoneType' object has no attribute 'to_capabilities'

 二、解决方法

此处我是用的是Appium-Python-Client 2.11.0和Selenium 4.10.0版本

AttributeError: ‘NoneType‘ object has no attribute ‘to_capabilities‘_第1张图片

使用其他版本也可以,可以逐个试一下。

你可能感兴趣的:(adb,appium,adb,selenium,python)