基本上我收到这个错误不管uiautomator2安装正确.我不太清楚为什么,也许这与我想要的能力有关?我以前用过云计算,但这是我第一次在自己的设备上运行自己的服务器。我的能力在云上运行良好。
Traceback (most recent call last):
File "c:\Users\me\Documents\dic\tempCodeRunnerFile.python", line 20, in <module>
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\appium\webdriver\webdriver.py", line 230, in __init__
super().__init__(
File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 288, in __init__
self.start_session(capabilities, browser_profile)
File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\appium\webdriver\webdriver.py", line 320, in start_session
response = self.execute(RemoteCommand.NEW_SESSION, w3c_caps)
File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\webdriver.py", line 444, in execute
self.error_handler.check_response(response)
File "C:\Users\me\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\selenium\webdriver\remote\errorhandler.py", line 249, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Could not find a driver for automationName 'UiAutomator2' and platformName 'Android'. Have you installed a driver that supports those capabilities? Run 'appium driver list --installed' to see. (Lower-level error: Could not find installed driver to support given caps)
Stacktrace:
UnknownError: An unknown server-side error occurred while processing the command. Original error: Could not find a driver for automationName 'UiAutomator2' and platformName 'Android'. Have you installed a driver that supports those capabilities? Run 'appium driver list --installed' to see. (Lower-level error: Could not find installed driver to support given caps)
at getResponseForW3CError (C:\Users\me\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\errors.js:1067:9)
at asyncHandler (C:\Users\me\AppData\Roaming\npm\node_modules\appium\node_modules\@appium\base-driver\lib\protocol\protocol.js:485:57)
字符串
我已经通过appium成功安装了UIautomator2:
appium driver install uiautomator2
√ Installing 'uiautomator2' using NPM install spec 'appium-uiautomator2-driver'
i Driver uiautomator2@2.14.0 successfully installed
- automationName: UiAutomator2
- platformNames: ["Android"]
型
我的代码:
from appium import webdriver
from appium.options.android import UiAutomator2Options
from appium.webdriver.common.touch_action import TouchAction
from appium.webdriver.common.mobileby import MobileBy
from appium.webdriver.appium_service import AppiumService
import time
"""os.system("start /B start cmd.exe @cmd /k appium -a 127.0.0.1 -p 4723")"""
appium_service = AppiumService()
appium_service.start(args=['--base-path', '/wd/hub'])
desired_caps = {
'automationName': 'UiAutomator2',
'platformName': 'Android',
'deviceName': 'Galaxy S20+ 5G',
'app': 'E:/g.apk',
'appPackage': 'com.google.android.gm',
'appActivity': 'com.google.android.gm.ui.MailActivityGmail',
'fullReset': 'true',
'newCommandTimeout': '3600',
}
driver = webdriver.Remote('http://localhost:4723/wd/hub', desired_caps)
time.sleep(100)
型
1条答案
按热度按时间5uzkadbs1#
我也犯了同样的错误。在我的情况下,这是因为安装尚未反映。重启后运行。