basically I am receiving this error regardless of the uiautomator2 being installed correctly. I'm not too sure why, maybe it's something to do with my desired capabilities? I've used cloud appium before, but this is the first time I am running my own server on my own device. My capabilities work fine on cloud.
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)
I have installed UIautomator2 via appium successfully:
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"]
My code:
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)