Concurrent Android emulators
See original GitHub issueThe problem
I am in most cases unable to run multiple Android emulators concurrently because Appium is unable to find one of the emulators. It looks like a bug to me now but I will explain more and let you decide.
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: 5.1.1, 7.1.1
- Real device or emulator/simulator: emulator
- Appium CLI or Appium.app|exe: CLI
Details
There is one case where concurrent emulators actually work, and one where it does not. I will share logs from the case where it does not work.
I run two Appium server instances with the following parameters:
appium --default-capabilities default-capabilities-02.json --port 4725 --bootstrap-port 4726 --chromedriver-port 9515
appium --default-capabilities default-capabilities-03.json --port 4727 --bootstrap-port 4728 --chromedriver-port 9517
default-capabilities-02.json:
{
"avdArgs": "-port 5556",
"udid": "emulator-5556"
}
default-capabilities-03.json:
{
"avdArgs": "-port 5558",
"udid": "emulator-5558"
}
Run the script below in this order without any emulators running:
python test_android_appium.py chrome 7.1 4725
python test_android_appium.py browser 5.1 4727
Note: Make sure to create AVDs with the names “Nexus_5_5.1” and “Nexus_5_7.1”.
In this case, the first emulator will boot up and run the tests successfully. The second emulator is stuck with a black screen, unable to boot.
I make a note of a couple weird lines in one of the logs:
[debug] [ADB] Telnet command got response: Nexus_5_7.1
[debug] [ADB] Emulator Nexus_5_5.1 not running
There is however a way to make this work by running both commands immediately:
python test_android_appium.py chrome 7.1 4725 &
python test_android_appium.py browser 5.1 4727 &
Both emulators boot up and run the tests. From this point, I can run new tests successfully on both emulators. I suspect that this may not always work.
Link to Appium logs
02: https://gist.github.com/SteffenL/9719119c7d15ddc267cafb49797b2f7c 03: https://gist.github.com/SteffenL/8112fad8ad38ee45a849193a2b90fd86
Code To Reproduce Issue [ Good To Have ]
test_android_appium.py:
import sys
from selenium import webdriver
def main():
browser = sys.argv[1]
version = sys.argv[2]
webdriver_port = sys.argv[3]
cap = {"browserName": browser, "platformName": "Android", "deviceName": "Android Emulator", "platformVersion": version, "avd": "Nexus_5_{0}".format(version)}
driver = webdriver.Remote("http://localhost:{0}/wd/hub".format(webdriver_port), cap)
driver.get("http://www.seleniumhq.org/")
driver.quit()
if __name__ == "__main__":
main()
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (5 by maintainers)
Top GitHub Comments
I’m seeing the same behavior. Digging a little deeper.
Interesting. Looking into this.