I use appium in Python, I’ve been using it for the past year to run some automation. However, every so often, when I want to turn off the service via a quit() call, appium hangs up for 5-10 minutes before stopping.
Here is how I start the driver:
desired_caps = dict(
platformName='Android',
platformVersion='7.1.2',
automationName='uiautomator2',
deviceName='SomeDeviceName',
newCommandTimeout=0,
udid='SomeUDid',
uiautomator2ServerInstallTimeout=120000
)
server_address = "http://127.0.0.1:" + str(self.appium_server.get_current_port()) + "/wd/hub"
self.driver = webdriver.Remote(server_address, desired_caps)
Here is how I start the AppiumService:
`self.service = AppiumService()`
`self.service.start(args=['--address', '127.0.0.1', '-p', str(self.port)])`
And here is how I stop the service:
self.driver.quit()
self.service.stop()
I only use three kinds of actions in Appium:
Take screenshot of entire device
Click x,y
Drag
It is also possible in my application for someone to start/stop the service several times.
My application can run endlessly, often 24 hours or more at a time. However, I restart the appium service (not driver) to what I call “clean” out the memory as the appium service can’t handle running more than a certain amount of time.
However, when the user wants to stop the service, I call driver.quit() - Every once in a while, the driver will hang for 5-10 minutes at the quit() call. And I have no idea why.
Any help would be appreciated. Several hundred people use my product and this is a common issue.