Why is AppiumService() not working?

I’m trying to activate AppiumService() on Mac, this is my code:

appium_service = AppiumService()
appium_service.start(args=['--address', '127.0.0.1', '--p', '4723', '--base-path', '/wd/hub'])

print(appium_service.is_running)
print(appium_service.is_listening)

desired_caps = {}
desired_caps['platformName'] = 'Android'
desired_caps['automationName'] = 'UiAutomator2'
desired_caps['deviceName'] = 'Android'
desired_caps['appPackage'] = "com.goibibo"
desired_caps['appActivity'] = '.common.HomeActivity'
desired_caps['noReset'] = True

driver = webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)

driver.implicitly_wait(10)
time.sleep(10)
driver.quit()

appium_service.stop()

But when the Python file is executed, nothing happens, neither the script executes, nor does it give an error, it is also stopped in a strange way, even if hours pass!

Possibly due to typo here…

Yes, there is a typo
But my code is out of line
appium_service = AppiumService()
It does not pass to the next, in
sudo lsof -i -P | grep LISTEN | grep :$PORT


I have checked that the server is activated, but it is not working!!!

This solved my problem:

appium_service.start(args=['--address', '127.0.0.1', '-p', '4723', '--base-path', '/wd/hub'])

Actually adding ‘–base-path’, ‘/wd/hub’ fixed the problem.

We travel from fault to fault
Now that I have fixed that error, it gives a new error:

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)

These errors occur when I use the Appium Server GUI and nothing occurs, it’s a bit strange for me!

https://appium.io/docs/en/2.1/guides/migrating-1-to-2/

1 Like