budtmo / docker-android

Android in docker solution with noVNC supported and video recording
Other
9.56k stars 1.27k forks source link

Error when calling driver.fingerPrint() #352

Closed bhein-sherpa6 closed 1 year ago

bhein-sherpa6 commented 1 year ago

🐛 Bug Report

Operating System: OSX Big Sur

Docker Image: budtmo/docker-android-real-device

Docker Version:
4.17.0

Docker-compose version (Only if you use it):
N/A

Docker Command to start docker-android:
$ docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 --name appium budtmo/docker-android-real-device

Expected Behavior

Calling driver.fingerPrint() places finger on emulator/real device.

Actual Behavior

error: could not connect to TCP port 5554: Cannot assign requested address

I opened an equivalent ticket regarding this on the appium-docker-android project a few months back (https://github.com/appium/appium-docker-android/issues/150). I was directed to use this docker image/project instead, as I was running it against an Android emulator. However, this issue is occurring on this project as well. Below is the description of that issue copied over:

An error is occurring when trying to call the fingerPrint() method against the containerized Appium server

driver.fingerPrint(1);

Error:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Error executing adbExec. Original error: 'Command '/opt/android/platform-tools/adb -H host.docker.internal -P 5037 -s emulator-5554 emu finger touch 1' exited with code 1'; Command output: error: could not connect to TCP port 5554: Cannot assign requested address

I can also reproduce this by calling adb inside the container directly:

brandon@Brandons-MacBook-Pro provisioner % docker exec -it appium adb -H host.docker.internal -s emulator-5554 -e emu finger touch 1 error: could not connect to TCP port 5554: Cannot assign requested address

This call works as expected using a local Appium server and or adb.

bhein-sherpa6 commented 1 year ago

I managed to run this one to ground myself. According to this page: https://developer.android.com/studio/run/emulator-console

image

I.e. the driver.fingerPrint() method (which is an emu command, as shown in my OP) will not work on any configuration where adb and the target device are not on the same host. In this project, appium (and it's associated adb) are running in a docker container, and emulators and/or physical devices are connected to the docker host, outside the container, thus the emulator console commands will not work.

Closing this ticket.