Android emulator does not quit automatically
See original GitHub issueThe problem
When running Selenium tests on an Android virtual device, the device does not power off after the test ends, and the emulator does not quit.
Environment
- Appium version (or git revision) that exhibits the issue: 1.6.3
- Last Appium version that did not exhibit the issue (if applicable):
- Desktop OS/version used to run Appium: macOS 10.12.2
- Node.js version (unless using Appium.app|exe): 7.1.0
- Mobile platform/version under test: Android 5.1.1, 6.0, 7.1.1
- Real device or emulator/simulator: Emulator
- Appium CLI or Appium.app|exe: Appium CLI
Details
I have a basic Python script that runs a simple test with Selenium and Appium in a web browser.
The test runs all right but afterwards, the emulator itself never quits. I expected that it would behave like the iOS simulator.
Since the emulator does not quit automatically, I can also not conveniently run tests on another virtual device on the same host machine (attempting to do so can lead Appium to crash).
Link to Appium logs
https://gist.github.com/SteffenL/2f01cad53d43bf5ec34a54e00c386aaf
Code To Reproduce Issue [ Good To Have ]
Sample code: sample-code/examples/python/android_simple.py
A simpler example:
from selenium import webdriver
cap = {"browserName": "Browser", "platformName": "Android", "deviceName": "Android Emulator", "platformVersion": "5.1.1", "automationName": "Appium", "avd": "Nexus_5_5.1.1"}
driver = webdriver.Remote("http://localhost:4723/wd/hub", cap)
driver.get("http://www.seleniumhq.org/")
driver.quit()
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:18 (4 by maintainers)
Top Results From Across the Web
[Solved] My android emulator (AVD) shut down automatically
Go to Menu->Tools->Android and uncheck the option Enable ADB Integration Run the application. Now the emulator will be launched, but app will ...
Read more >Troubleshoot known issues with Android Emulator
To do so, in the emulator window, click on Settings > View Mode and select Window instead of Dock Pinned.
Read more >How to Power Off / Restart Android Device Emulator in ...
Android AVD Simulator not Working | Fix AVD Simulator in Android Studio | AVD Simulator Black Screen · How to Remove Root (Un...
Read more >6 Ways To Fix Android Emulator App Keeps Crashing/Stopping
Way 1: Check for Enough Disk Space · Way 2: Unsupported Version Of Mac OS · Way 3: Antivirus Software To Fix Android...
Read more >What's the proper way to shit down the emulator? : r/androiddev
Sometimes I've seen the qemu process become orphaned - closing Android Studio does not kill the emulator process. In cases like that, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 how can we influence to increase the priority of this ticket? 😃
@mykola-mokhnach - this UIA2 feature works to close the emulator but i think there is a little bit of a chicken-and-egg problem. The issue is that if you call driver.executeScript(“mobile: execEmuConsoleCommand”, “kill”, “device_udid”) before driver.quit(), driver.quit() will fail because emulator is gone. And you cant execute the kill command after driver.quit() because session will be null. IMO, closing the emulator needs to be made part of the driver.quit() call routine. Agree with @jlipps previous suggestion that maybe the kill command in driver.quit() can be conditional on the avd capability. Does this sound reasonable?