budtmo / docker-android

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

[🐛 Bug ]: Appium is not Up and Running & Appium Server UI is not visible at localhost:6080 #354

Closed jayamvishnudeep closed 1 year ago

jayamvishnudeep commented 1 year ago

Operating System

Ubuntu 20.04.5 LTS

Docker Image

budtmo/docker-android:emulator_11.0 or any other latest images

Expected behaviour

Hiii budtmo!! Thanks a lot for your wonderful job and for your hard work in making this possible. Recently i have found your repo and started using docker android with appium and everything was working as expected. I use to see the emulator along with the Appium server UI up and running at localhost:6080. But due to the recent changes I'm not able to see the Appium server up and running.

Can you please fix it :)

Actual behaviour

I see that due to the recent changes that have been made in the repo, i only see the emulator and don't see Appium server up and running and also the Server UI is not visible in localhost:6080 after running the below command

docker run -d -p 6080:6080 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e APPIUM=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0

or

docker run --privileged -d -p 6080:6080 -p 5554:5554 -p 5555:5555 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" e APPIUM=true -e CONNECT_TO_GRID=true -e APPIUM_HOST="127.0.0.1" -e APPIUM_PORT=4723 -e SELENIUM_HOST="172.17.0.1" -e SELENIUM_PORT=4444 --name android-container budtmo/docker-android:emulator_12.0

Our team is thinking of using this and integrate to our jenkins CI. Would be great if you can fix this issue :bow:

Attachment of the localhost:6080 below:

No appium server UI

Logs

2023-05-15 13:57:49,302 INFO supervisord started with pid 9 2023-05-15T13:57:49.302981575Z 2023-05-15 13:57:49,302 INFO supervisord started with pid 8 2023-05-15T13:57:49.303023643Z 2023-05-15 13:57:49,302 INFO supervisord started with pid 7 2023-05-15T13:57:50.305559979Z 2023-05-15 13:57:50,305 INFO spawned: 'android_port_forward' with pid 13 2023-05-15T13:57:50.305581400Z 2023-05-15 13:57:50,305 INFO spawned: 'd_screen' with pid 15 2023-05-15T13:57:50.305585490Z 2023-05-15 13:57:50,305 INFO spawned: 'appium' with pid 14 2023-05-15T13:57:50.306993390Z 2023-05-15 13:57:50,306 INFO spawned: 'd_wm' with pid 16 2023-05-15T13:57:50.307429103Z 2023-05-15 13:57:50,307 INFO spawned: 'device' with pid 17 2023-05-15T13:57:50.308357204Z 2023-05-15 13:57:50,308 INFO spawned: 'vnc_server' with pid 18 2023-05-15T13:57:50.309313760Z 2023-05-15 13:57:50,309 INFO spawned: 'log_web_shared' with pid 19 2023-05-15T13:57:50.309873972Z 2023-05-15 13:57:50,309 INFO spawned: 'vnc_web' with pid 20 2023-05-15T13:57:50.484444783Z 2023-05-15 13:57:50,484 INFO exited: log_web_shared (exit status 0; not expected) 2023-05-15T13:57:51.467195471Z 2023-05-15 13:57:51,467 INFO success: android_port_forward entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2023-05-15T13:57:51.480730204Z 2023-05-15 13:57:51,480 INFO success: d_screen entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2023-05-15T13:57:51.480740451Z 2023-05-15 13:57:51,480 INFO success: d_wm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2023-05-15T13:57:51.480742432Z 2023-05-15 13:57:51,480 INFO success: vnc_server entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2023-05-15T13:57:51.480760334Z 2023-05-15 13:57:51,480 INFO success: vnc_web entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2023-05-15T13:57:51.485712179Z 2023-05-15 13:57:51,485 INFO success: appium entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2023-05-15T13:57:51.485718992Z 2023-05-15 13:57:51,485 INFO success: device entered RUNNING state, process has stayed up for > than 1 seconds (startsecs) 2023-05-15T13:57:51.486385283Z 2023-05-15 13:57:51,486 INFO spawned: 'log_web_shared' with pid 95 2023-05-15T13:57:51.643882313Z 2023-05-15 13:57:51,643 INFO exited: log_web_shared (exit status 0; not expected) 2023-05-15T13:57:53.951221220Z 2023-05-15 13:57:53,951 INFO spawned: 'log_web_shared' with pid 112 2023-05-15T13:57:54.105842045Z 2023-05-15 13:57:54,105 INFO exited: log_web_shared (exit status 0; not expected) 2023-05-15T13:57:57.223829476Z 2023-05-15 13:57:57,223 INFO spawned: 'log_web_shared' with pid 114 2023-05-15T13:57:57.373883576Z 2023-05-15 13:57:57,373 INFO exited: log_web_shared (exit status 0; not expected) 2023-05-15T13:57:58.375686268Z 2023-05-15 13:57:58,375 INFO gave up: log_web_shared entered FATAL state, too many start retries too quickly

lhincapie0 commented 1 year ago

👍 Same for me

handfreezer commented 1 year ago

👍 Same for me

budtmo commented 1 year ago

Hi,

please check the documentation again, you can access the whole logs through the port, so you dont need the windows to see the Appium log. it is even better. I will close the ticket but feel free to reopen

jayamvishnudeep commented 1 year ago

Hi budtmo 🙏

Thanks for your response.

I have tried running the below command

docker run -d -p 6080:6080 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e APPIUM=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0 -e WEB_LOG=true -e WEB_LOG_PORT=9001

and when reached localhost:9000 I see the message 'This site can't be reached' message. image

lhincapie0 commented 1 year ago

@jayamvishnudeep you are passing WEB_LOG_PORT=9001 and trying to check them in the 9000

jayamvishnudeep commented 1 year ago

@lhincapie0 oops ... may be i might uploaded wrong attachment...even for localhost:9001 its the same unfortunately 😞

So the below one is the command i used docker run -d -p 6080:6080 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e APPIUM=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0 -e WEB_LOG=true -e WEB_LOG_PORT=9001

And the screenshot of localhost:9001 is image

lhincapie0 commented 1 year ago
image

mmm dont know, I'm still not able to run appium there, not see much logs

image

Those are the appium logs but when I try to run them I get error: Error forwarding the new session Empty pool of VM for setup Capabilities

jayamvishnudeep commented 1 year ago

@lhincapie0 may i know what was the command used to get the logs?

is it docker run -d -p 6080:6080 -p 4723:4723 -e EMULATOR_DEVICE="Samsung Galaxy S10" -e WEB_VNC=true -e APPIUM=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0 -e WEB_LOG=true -e WEB_LOG_PORT=32789 ???

jayamvishnudeep commented 1 year ago

Even i get the same error when i tried to build from the old code :

Step failed org.openqa.selenium.SessionNotCreatedException: Unable to create a new remote session. Please check the server log for more details. Original error: Error forwarding the new session Empty pool of VM for setup Capabilities {.......} Command duration or timeout: 137 milliseconds

lhincapie0 commented 1 year ago

Actually im running it on an EC2, so im mapping the port of the docker an opening a tunnel to the instance to access that port, but i can also map it to the same 9000 port.

This is part of a docker-compose file I have:

app: image: budtmo/docker-android:emulator_12.0 privileged: true depends_on:

vamvindev commented 1 year ago

This is still an issue. I'm unable to start a session also.

@budtmo I see that you commented that we can check the logs from within the container but in no way or shape it's addressing the actual issue of Appium not being able to start a session.

This is the docker command I’m using to start the container

docker run -d -p 6080:6080 -p 4723:4723 -p 5555:5555 -e EMULATOR_DEVICE=“Samsung Galaxy S10” -e WEB_VNC=true -e APPIUM=true --device /dev/kvm --name android-container budtmo/docker-android:emulator_11.0

Below is my test setup in local which works perfectly in local Android emulator.

` @Test public void signUpValidations() throws MalformedURLException, InterruptedException {

DesiredCapabilities caps = new DesiredCapabilities(); caps.setCapability(“platformName”, “android”);

caps.setCapability(“appium:platformVersion”, “11”); caps.setCapability(“appium:deviceName”,“emulator-5554”); caps.setCapability(“appium:automationName”, “uiautomator2”); caps.setCapability(“appium:deviceName”, “Samsung Galaxy S10”); caps.setCapability(“appium:appPackage”, “com.wcs.witricity”); caps.setCapability(“appium:appActivity”, “com.wcs.witricity.feature.main.MainActivity”);

try { URL url = new URL(“http://127.0.0.1:4723/wd/hub”); driver = new AppiumDriver(url, caps); driver = new AndroidDriver(url, caps); } catch (MalformedURLException e) { e.printStackTrace(); } }`

And when the test is executed, this is the response in console

`org.openqa.selenium.WebDriverException: Connection refused: no further information Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03' System info: host: 'Local-Laptop', ip: '192.168.1.13', os.name: 'Windows 11', os.arch: 'amd64', os.version: '10.0', java.version: '20.0.1' Driver info: driver.version: AppiumDriver

at io.appium.java_client.remote.AppiumCommandExecutor.lambda$5(AppiumCommandExecutor.java:251)
at java.base/java.util.Optional.orElseGet(Optional.java:364)
at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:250)
at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
at io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:41)
at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1)
at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
at io.appium.java_client.AppiumDriver.startSession(AppiumDriver.java:336)
at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
at io.appium.java_client.DefaultGenericMobileDriver.<init>(DefaultGenericMobileDriver.java:37)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:88)
at io.appium.java_client.AppiumDriver.<init>(AppiumDriver.java:98)
at com.appiumtest.AppAccessValidations.signUpValidations(AppAccessValidations.java:40)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:578)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
at com.intellij.rt.junit.IdeaTestRunner$Repeater$1.execute(IdeaTestRunner.java:38)
at com.intellij.rt.execution.junit.TestsRepeater.repeat(TestsRepeater.java:11)
at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:35)
at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:232)
at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:55)

Caused by: java.net.ConnectException: Connection refused: no further information at java.base/sun.nio.ch.Net.pollConnect(Native Method) at java.base/sun.nio.ch.Net.pollConnectNow(Net.java:673) at java.base/sun.nio.ch.NioSocketImpl.timedFinishConnect(NioSocketImpl.java:535) at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:585) at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327) at java.base/java.net.Socket.connect(Socket.java:666) at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129) at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:245) at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:165) at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257) at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135) at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114) at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147) at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121) at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200) at okhttp3.RealCall.execute(RealCall.java:77) at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103) at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) at java.base/java.lang.reflect.Method.invoke(Method.java:578) at io.appium.java_client.remote.AppiumCommandExecutor$1.createSession(AppiumCommandExecutor.java:186) at io.appium.java_client.remote.AppiumCommandExecutor.createSession(AppiumCommandExecutor.java:217) at io.appium.java_client.remote.AppiumCommandExecutor.execute(AppiumCommandExecutor.java:239) ... 35 more `

I also made sure that the ports are exposed

PS C:\Users\vamsi> docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ad424312a3dd budtmo/docker-android:emulator_11.0 "/home/androidusr/do…" 55 seconds ago Up 54 seconds 0.0.0.0:4723->4723/tcp, 5554/tcp, 0.0.0.0:5555->5555/tcp, 5900/tcp, 0.0.0.0:6080->6080/tcp, 9000/tcp android-container

But if I go to localhost:4723, I see the below error {"status":9,"value":{"error":"unknown command","message":"The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource","stacktrace":""}}

image

daominah commented 1 year ago

I got this error too when I try to connect to "host:4723/wd/hub" with Appium Inspector 2023.7.1: Failed to create session. The requested resource could not be found, or a request was received using an HTTP method that is not supported by the mapped resource

vamvindev commented 1 year ago

Hey @daominah , @jayamvishnudeep - I found a fix for this. Check this issue : https://github.com/budtmo/docker-android/issues/359#issuecomment-1610649856