AppiumTestDistribution / appium-device-farm

This is an Appium 2.0 plugin designed to manage and create driver sessions on available devices.
https://devicefarm.org
Other
341 stars 103 forks source link

Physical device not mirroring, not going forward from loading screen #1407

Closed Hammad1954 closed 1 month ago

Hammad1954 commented 1 month ago

Describe the bug

I have created the server in my Ubuntu LTS 22 from Windows machine. And access the UI from browser. When I am clicking on use device it is not moving forward from loading screen.

Environment

  1. Appium version (or git revision) that exhibits the issue: 2.11.5
  2. Node.js version (unless using Appium.app|exe): v18.20.4
  3. Npm or Yarn package manager:10.8.3
  4. Mobile platform/version under test: Android
  5. Real device or emulator/simulator: Real device
erdncyz commented 1 month ago

Hi @Hammad1954 Can you share your log gist please ? Also you can share your browser network area ? Can you access appium inspector on windows machine ??

Hammad1954 commented 1 month ago

Hello @erdncyz Thanks for the response . please find the logs and network file .let me know if anything else needed

LOGS [HTTP] <-- GET /device-farm/ui-assets/index-f4_m9zhG.js 304 8 ms - - [HTTP] --> GET /device-farm/ui-assets/index-Cp7K0uA9.css {} [device-farm-main] Received non-webdriver request with url /device-farm/ui-assets/index-Cp7K0uA9.css. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ui-assets/index-Cp7K0uA9.css 304 7 ms - - [HTTP] --> GET /device-farm/ui-assets/device-farm-logo-nn1d6kPf.png {} [device-farm-main] Received non-webdriver request with url /device-farm/ui-assets/device-farm-logo-nn1d6kPf.png. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ui-assets/device-farm-logo-nn1d6kPf.png 304 7 ms - - [HTTP] --> GET /device-farm/api/device {} [device-farm-main] Received non-webdriver request with url /device-farm/api/device. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/api/device 200 14 ms - 497 [HTTP] --> GET /device-farm/api/queue/length {} [device-farm-main] Received non-webdriver request with url /device-farm/api/queue/length. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/api/queue/length 200 8 ms - 1 [HTTP] --> POST /device-farm/api/unblock {"udid":"ZD2229DWDP","host":"http://192.168.56.1:4723"} [device-farm-main] Received non-webdriver request with url /device-farm/api/unblock. So, not proxying it to downstream. [device-farm-main] Updated devices with filter: {"udid":{"$in":"ZD2229DWDP"}} [HTTP] <-- POST /device-farm/api/unblock 200 7 ms - 16 [HTTP] --> POST /device-farm/api/block {"udid":"ZD2229DWDP","host":"http://192.168.56.1:4723"} [device-farm-main] Received non-webdriver request with url /device-farm/api/block. So, not proxying it to downstream. [device-farm-main] Updated devices with filter: {"udid":{"$in":"ZD2229DWDP"}} [HTTP] <-- POST /device-farm/api/block 200 8 ms - 16 [HTTP] --> POST /device-farm/api/dashboard/appiumSession {"udid":"ZD2229DWDP","systemPort":61437,"origin":"http://192.168.0.112:4723"} [device-farm-main] Received non-webdriver request with url /device-farm/api/dashboard/appiumSession. So, not proxying it to downstream. [device-farm-main] Updated devices with filter: {"udid":{"$in":["ZD2229DWDP"]}} [HTTP] --> POST /wd/hub/session {"capabilities":{"alwaysMatch":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"ZD2229DWDP","df:skipReport":true,"appium:systemPort":61437,"appium:adbExecTimeout":80000,"appium:uiautomator2ServerLaunchTimeout":60000},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"ZD2229DWDP","df:skipReport":true,"appium:systemPort":61437}} [AppiumDriver@b6ff] Calling AppiumDriver.createSession() with args: [{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"ZD2229DWDP","df:skipReport":true,"appium:systemPort":61437},null,{"alwaysMatch":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"ZD2229DWDP","df:skipReport":true,"appium:systemPort":61437,"appium:adbExecTimeout":80000,"appium:uiautomator2ServerLaunchTimeout":60000},"firstMatch":[{}]}] [device-farm-main] 📱 Plugin Args: {"platform":"android","androidDeviceType":"both","iosDeviceType":"both"} [AppiumDriver@b6ff] Plugins which can handle cmd 'createSession': device-farm [AppiumDriver@b6ff] Plugin device-farm is now handling cmd 'createSession' [device-farm-main] 📱 pluginArgs: {"platform":"android","iosDeviceType":"both","androidDeviceType":"both","skipChromeDownload":true,"maxSessions":8,"adbRemote":[],"emulators":[],"simulators":[],"deviceAvailabilityTimeoutMs":300000,"deviceAvailabilityQueryIntervalMs":10000,"sendNodeDevicesToHubIntervalMs":30000,"checkStaleDevicesIntervalMs":30000,"checkBlockedDevicesIntervalMs":30000,"newCommandTimeoutSec":60,"bindHostOrIp":"192.168.56.1","enableDashboard":false,"removeDevicesFromDatabaseBeforeRunningThePlugin":false,"remoteConnectionTimeout":60000,"liveStreaming":true,"wdaBundleId":"","preBuildWDAPath":""} [device-farm-main] Receiving session request at host: 192.168.56.1 [device-farm-main] 📱 Creating temporary session capability_id: c832c7a5-eaa7-465b-a094-16b9d709cb65 [device-farm-main] Merged Capabilities: { "platformName": "android", "appium:automationName": "UIAutomator2", "appium:newCommandTimeout": 120, "appium:waitForIdleTimeout": 10, "appium:udid": "ZD2229DWDP", "df:skipReport": true, "appium:systemPort": 61437, "appium:adbExecTimeout": 80000, "appium:uiautomator2ServerLaunchTimeout": 60000 } [device-farm-main] Max session count: 8, Busy device count: 0 [device-farm-main] Waiting for free device. Filter: {"platform":"android","udid":"ZD2229DWDP","busy":false,"userBlocked":false}} [device-farm-main] Updated devices with filter: {"platform":"android","udid":{"$in":"ZD2229DWDP"}} [device-farm-main] Updated devices with filter: {"platform":"android","udid":{"$in":"ZD2229DWDP"}} [device-farm-main] 📱 Blocking device ZD2229DWDP at host http://192.168.56.1:4723 for new session [device-farm-main] Updating allocated device: "{"userBlocked":true,"offline":false,"adbPort":5037,"systemPort":61437,"sdk":"14","realDevice":true,"name":"eqs_g","busy":false,"state":"device","udid":"ZD2229DWDP","platform":"android","deviceType":"real","host":"http://192.168.56.1:4723","totalUtilizationTimeMilliSec":0,"sessionStartTime":0,"width":"1080","height":"2400","liveStreaming":true,"tags":[],"nodeId":"6d419c32-d5b8-433b-98eb-2d7c6c219c48","meta":{"revision":3,"created":1728032352378,"version":0,"updated":1728032575631},"$loki":1}" [device-farm-main] Updated allocated device: "[{"userBlocked":true,"offline":false,"adbPort":5037,"systemPort":61437,"sdk":"14","realDevice":true,"name":"eqs_g","busy":true,"state":"device","udid":"ZD2229DWDP","platform":"android","deviceType":"real","host":"http://192.168.56.1:4723","totalUtilizationTimeMilliSec":0,"sessionStartTime":0,"width":"1080","height":"2400","liveStreaming":true,"tags":[],"nodeId":"6d419c32-d5b8-433b-98eb-2d7c6c219c48","meta":{"revision":5,"created":1728032352378,"version":0,"updated":1728032575732},"$loki":1,"newCommandTimeout":120}]" [device-farm-main] device.host: http://192.168.56.1:4723 and pluginArgs.bindHostOrIp: 192.168.56.1 [device-farm-main] 📱 Creating session on the same node [device-farm-main] 📱 Live streaming argument is set to true, preparing device for live streaming Current directory: /home/uts/node_modules/appium-device-farm/lib/stream.apk [ADB] Running '/home/uts/Android/Sdk/platform-tools/adb -P 5037 -s ZD2229DWDP install /home/uts/node_modules/appium-device-farm/lib/stream.apk' [device-farm-main] Installed /home/uts/node_modules/appium-device-farm/lib/stream.apk on device ZD2229DWDP [ADB] Running '/home/uts/Android/Sdk/platform-tools/adb -P 5037 -s ZD2229DWDP shell pm list packages' Allowing recording permissions [ADB] Running '/home/uts/Android/Sdk/platform-tools/adb -P 5037 -s ZD2229DWDP shell appops set com.device.farm PROJECT_MEDIA allow' [ADB] Running '/home/uts/Android/Sdk/platform-tools/adb -P 5037 -s ZD2229DWDP shell am start -W -n com.device.farm/com.device.farm.ScreenCaptureActivity' [HTTP] --> GET /device-farm/api/device {} [device-farm-main] Received non-webdriver request with url /device-farm/api/device. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/api/device 200 6 ms - 520 [HTTP] --> GET /device-farm/api/queue/length {} [device-farm-main] Received non-webdriver request with url /device-farm/api/queue/length. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/api/queue/length 200 6 ms - 1 [ADB] Running '/home/uts/Android/Sdk/platform-tools/adb -P 5037 -s ZD2229DWDP forward tcp:61437 tcp:1991' Pressing home [ADB] Running '/home/uts/Android/Sdk/platform-tools/adb -P 5037 -s ZD2229DWDP shell input keyevent KEYCODE_HOME' [device-farm-main] Websocket event received, streaming app is running [AppiumDriver@b6ff] Executing default handling behavior for command 'createSession' [AppiumDriver@b6ff] Event 'newSessionRequested' logged at 1728032586414 (14:33:06 GMT+0530 (India Standard Time)) [Appium] Attempting to find matching driver for automationName 'UIAutomator2' and platformName 'android' [AppiumDriver@b6ff] Event 'newSessionStarted' logged at 1728032586432 (14:33:06 GMT+0530 (India Standard Time)) [device-farm-main] 📱 c832c7a5-eaa7-465b-a094-16b9d709cb65 Session response: {"protocol":"W3C","error":{}} [device-farm-main] 📱 Removing pending session with capability_id: c832c7a5-eaa7-465b-a094-16b9d709cb65 [device-farm-main] c832c7a5-eaa7-465b-a094-16b9d709cb65 📱 Device UDID ZD2229DWDP unblocked. Reason: Failed to create session [AppiumDriver@b6ff] Encountered internal error running command: Error: Error: Could not find a driver for automationName 'UIAutomator2' and platformName 'android'. Have you installed a driver that supports those capabilities? Run 'appium driver list --installed' to see. (Lower-level error: Could not find installed driver to support given caps) at bs.this (/home/uts/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:347:23) at bs.generator (/home/uts/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:333:17) at Generator.next () at bV (/home/uts/node_modules/appium-device-farm/lib/webpack:/appium-device-farm/lib/src/plugin.js:28:48) [HTTP] <-- POST /wd/hub/session 500 10927 ms - 1102 [device-farm-main] Received error from remote node: {"message":"Request failed with status code 500","name":"AxiosError","stack":"AxiosError: Request failed with status code 500\n at settle (/home/uts/node_modules/axios/lib/core/settle.js:19:12)\n at IncomingMessage.handleStreamEnd (/home/uts/node_modules/axios/lib/adapters/http.js:599:11)\n at IncomingMessage.emit (node:events:529:35)\n at endReadableNT (node:internal/streams/readable:1400:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)\n at Axios.request (/home/uts/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":260000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","User-Agent":"axios/1.7.7","Content-Length":"553","Accept-Encoding":"gzip, compress, deflate, br"},"method":"post","url":"http://127.0.0.1:4723/wd/hub/session","data":"{\"capabilities\":{\"alwaysMatch\":{\"platformName\":\"android\",\"appium:automationName\":\"UIAutomator2\",\"appium:newCommandTimeout\":120,\"appium:waitForIdleTimeout\":10,\"appium:udid\":\"ZD2229DWDP\",\"df:skipReport\":true,\"appium:systemPort\":61437,\"appium:adbExecTimeout\":80000,\"appium:uiautomator2ServerLaunchTimeout\":60000},\"firstMatch\":[{}]},\"desiredCapabilities\":{\"platformName\":\"android\",\"appium:automationName\":\"UIAutomator2\",\"appium:newCommandTimeout\":120,\"appium:waitForIdleTimeout\":10,\"appium:udid\":\"ZD2229DWDP\",\"df:skipReport\":true,\"appium:systemPort\":61437}}"},"code":"ERR_BAD_RESPONSE","status":500} [HTTP] <-- POST /device-farm/api/dashboard/appiumSession 400 10965 ms - 1132 [HTTP] --> POST /device-farm/api/unblock {"udid":"ZD2229DWDP","host":"http://192.168.56.1:4723"} [device-farm-main] Received non-webdriver request with url /device-farm/api/unblock. So, not proxying it to downstream. [device-farm-main] Updated devices with filter: {"udid":{"$in":"ZD2229DWDP"}} [HTTP] <-- POST /device-farm/api/unblock 200 7 ms - 16 [device-farm-main] New streaming request recieved with url: /android-stream/ZD2229DWDP [device-farm-main] Device id ZD2229DWDP matched for streaming url : /android-stream/ZD2229DWDP [device-farm-main] Updated devices with filter: {"udid":{"$in":["ZD2229DWDP"]}} [device-farm-main] Invalid device or streaming not supported for device id ZD2229DWDP [HTTP] --> GET /device-farm/ui-assets/device-loading-BbhTw1Mo.gif {} [device-farm-main] Received non-webdriver request with url /device-farm/ui-assets/device-loading-BbhTw1Mo.gif. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ui-assets/device-loading-BbhTw1Mo.gif 304 5 ms - - [HTTP] <-- GET /android-stream/ZD2229DWDP - - ms - - [device-farm-main] Found 0 device candidates to be released [device-farm-main] Cleaning pending sessions... [device-farm-main] No pending sessions to clean

BROWSER NETWORK

192.168.0.112.zip

erdncyz commented 1 month ago

I think you don't have UIAutomator2 driver.

You can install please.

appium driver install uiautomator2

You can look this commend. appium driver list

Your gist error message :

Failed to create session [AppiumDriver@b6ff] Encountered internal error running command: Error: Error: Could not find a driver for automationName 'UIAutomator2' and platformName 'android'. Have you installed a driver that supports those capabilities? Run 'appium driver list --installed' to see. (Lower-level error: Could not find installed driver to support given caps)

Hammad1954 commented 1 month ago

Hello @erdncyz , i have installed the Uiautomator2 but still not able to use device

[HTTP] --> GET /device-farm/ {} [device-farm-main] Received non-webdriver request with url /device-farm/. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ 200 26 ms - 513 [HTTP] --> GET /device-farm/ui-assets/index-f4_m9zhG.js {} [device-farm-main] Received non-webdriver request with url /device-farm/ui-assets/index-f4_m9zhG.js. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ui-assets/index-f4_m9zhG.js 304 22 ms - - [HTTP] --> GET /device-farm/ui-assets/index-Cp7K0uA9.css {} [device-farm-main] Received non-webdriver request with url /device-farm/ui-assets/index-Cp7K0uA9.css. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ui-assets/index-Cp7K0uA9.css 304 4 ms - - [HTTP] --> GET /device-farm/api/device {} [device-farm-main] Received non-webdriver request with url /device-farm/api/device. So, not proxying it to downstream. [HTTP] --> GET /device-farm/ui-assets/device-farm-logo-nn1d6kPf.png {} [device-farm-main] Received non-webdriver request with url /device-farm/ui-assets/device-farm-logo-nn1d6kPf.png. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ui-assets/device-farm-logo-nn1d6kPf.png 304 4 ms - - [HTTP] --> GET /dashboard/api/ping {} [device-farm-main] Received non-webdriver request with url /dashboard/api/ping. So, not proxying it to downstream. [HTTP] No route found for /dashboard/api/ping [HTTP] <-- GET /dashboard/api/ping 404 14 ms - 211 [HTTP] <-- GET /device-farm/api/device 200 121 ms - 476 [HTTP] --> GET /device-farm/api/queue/length {} [device-farm-main] Received non-webdriver request with url /device-farm/api/queue/length. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/api/queue/length 304 7 ms - - [HTTP] --> POST /device-farm/api/block {"udid":"RZ8M93AQKDH","host":"http://192.168.56.1:4723"} [device-farm-main] Received non-webdriver request with url /device-farm/api/block. So, not proxying it to downstream. [device-farm-main] Updated devices with filter: {"udid":{"$in":"RZ8M93AQKDH"}} [HTTP] <-- POST /device-farm/api/block 200 9 ms - 16 [HTTP] --> POST /device-farm/api/dashboard/appiumSession {"udid":"RZ8M93AQKDH","systemPort":64149,"origin":"http://192.168.0.112:4723"} [device-farm-main] Received non-webdriver request with url /device-farm/api/dashboard/appiumSession. So, not proxying it to downstream. [device-farm-main] Updated devices with filter: {"udid":{"$in":["RZ8M93AQKDH"]}} [HTTP] --> POST /wd/hub/session {"capabilities":{"alwaysMatch":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8M93AQKDH","df:skipReport":true,"appium:systemPort":64149,"appium:adbExecTimeout":80000,"appium:uiautomator2ServerLaunchTimeout":60000},"firstMatch":[{}]},"desiredCapabilities":{"platformName":"android","appium:automationName":"UIAutomator2","appium:newCommandTimeout":120,"appium:waitForIdleTimeout":10,"appium:udid":"RZ8M93AQKDH","df:skipReport":true,"appium:systemPort":64149}} [device-farm-main] Received non-webdriver request with url /wd/hub/session. So, not proxying it to downstream. [HTTP] No route found for /wd/hub/session [HTTP] <-- POST /wd/hub/session 404 5 ms - 211 [device-farm-main] Received error from remote node: {"message":"Request failed with status code 404","name":"AxiosError","stack":"AxiosError: Request failed with status code 404\n at settle (/home/uts/node_modules/axios/lib/core/settle.js:19:12)\n at IncomingMessage.handleStreamEnd (/home/uts/node_modules/axios/lib/adapters/http.js:599:11)\n at IncomingMessage.emit (node:events:529:35)\n at endReadableNT (node:internal/streams/readable:1400:12)\n at processTicksAndRejections (node:internal/process/task_queues:82:21)\n at Axios.request (/home/uts/node_modules/axios/lib/core/Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:95:5)","config":{"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http","fetch"],"transformRequest":[null],"transformResponse":[null],"timeout":260000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, /","Content-Type":"application/json","User-Agent":"axios/1.7.7","Content-Length":"555","Accept-Encoding":"gzip, compress, deflate, br"},"method":"post","url":"http://127.0.0.1:4723/wd/hub/session","data":"{\"capabilities\":{\"alwaysMatch\":{\"platformName\":\"android\",\"appium:automationName\":\"UIAutomator2\",\"appium:newCommandTimeout\":120,\"appium:waitForIdleTimeout\":10,\"appium:udid\":\"RZ8M93AQKDH\",\"df:skipReport\":true,\"appium:systemPort\":64149,\"appium:adbExecTimeout\":80000,\"appium:uiautomator2ServerLaunchTimeout\":60000},\"firstMatch\":[{}]},\"desiredCapabilities\":{\"platformName\":\"android\",\"appium:automationName\":\"UIAutomator2\",\"appium:newCommandTimeout\":120,\"appium:waitForIdleTimeout\":10,\"appium:udid\":\"RZ8M93AQKDH\",\"df:skipReport\":true,\"appium:systemPort\":64149}}"},"code":"ERR_BAD_REQUEST","status":404} [HTTP] <-- POST /device-farm/api/dashboard/appiumSession 400 39 ms - 241 [HTTP] --> POST /device-farm/api/unblock {"udid":"RZ8M93AQKDH","host":"http://192.168.56.1:4723"} [device-farm-main] Received non-webdriver request with url /device-farm/api/unblock. So, not proxying it to downstream. [device-farm-main] Updated devices with filter: {"udid":{"$in":"RZ8M93AQKDH"}} [HTTP] <-- POST /device-farm/api/unblock 200 4 ms - 16 [device-farm-main] New streaming request recieved with url: /android-stream/RZ8M93AQKDH [device-farm-main] Device id RZ8M93AQKDH matched for streaming url : /android-stream/RZ8M93AQKDH [device-farm-main] Updated devices with filter: {"udid":{"$in":["RZ8M93AQKDH"]}} [device-farm-main] Invalid device or streaming not supported for device id RZ8M93AQKDH [HTTP] --> GET /device-farm/ui-assets/device-loading-BbhTw1Mo.gif {} [device-farm-main] Received non-webdriver request with url /device-farm/ui-assets/device-loading-BbhTw1Mo.gif. So, not proxying it to downstream. [HTTP] <-- GET /device-farm/ui-assets/device-loading-BbhTw1Mo.gif 304 5 ms - - [HTTP] <-- GET /android-stream/RZ8M93AQKDH - - ms - - [device-farm-main] Found 0 device candidates to be released [device-farm-main] Cleaning pending sessions... [device-farm-main] No pending sessions to clean [device-farm-main] Found 0 device candidates to be released [device-farm-main] Cleaning pending sessions... [device-farm-main] No pending sessions to clean

erdncyz commented 1 month ago

Hi @Hammad1954

Can you stop appium and then you can write "appium plugin run device-farm reset" this commend and then start again your appium.

Also please you should share logs with gist not write comment.

Hammad1954 commented 1 month ago

Hello @erdncyz i have done the reset please check the updated logs

https://gist.github.com/Hammad1954/2202ff14cd08370b056cc262d3b370b3

saikrishna321 commented 1 month ago

@Hammad1954 Can you start the server as

appium server  -pa /wd/hub --use-plugins=device-farm --plugin-device-farm-platform=Android
Hammad1954 commented 1 month ago

@saikrishna321 issue is resolved now, it was not working because i was not using -pa /wd/hub as a endpoint in server creation