Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat]: add waitForWebviewMs for Android as well #19251

Closed
KazuCocoa opened this issue Oct 5, 2023 · 0 comments · Fixed by appium/appium-android-driver#860 or appium/appium-uiautomator2-driver#699
Labels
Enhancement feature Mobile Chrome related to mobile Chrome driver

Comments

@KazuCocoa
Copy link
Member

KazuCocoa commented Oct 5, 2023

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Add wait for like waitForWebviewMs in xcuitest https://appium.github.io/appium-xcuitest-driver/5.6/execute-methods/ for android's https://github.com/appium/appium-android-driver/blob/43688b961dd0f6f97733621c3857ff95f2bfb55c/lib/helpers/webview.ts#L186

In chrome v117, i saw kind of frequently the chrome_devtools_remote finding needed more longer time than before. For example, sometimes get contexts method should be called a couple of times in some ms interval to get chrome browser's WEBVIEW_chrome context.

for example, after launching a chrome browser process (with appPackage cap), it needed a couple of seconds to get the WEBVIEW_chrome context by repeating below error.

2023-10-05 01:36:52:007 - [HTTP]
2023-10-05 01:36:58:430 - [HTTP] --> GET /wd/hub/session/046cd22b-cd30-47c5-b8b4-8ec00bfef3e2/contexts
2023-10-05 01:36:58:430 - [HTTP] {}
2023-10-05 01:36:58:430 - [debug] [W3C (046cd22b)] Calling AppiumDriver.getContexts() with args: ["046cd22b-cd30-47c5-b8b4-8ec00bfef3e2"]
2023-10-05 01:36:58:430 - [debug] [AndroidDriver] Getting a list of available webviews
2023-10-05 01:36:58:430 - [debug] [ADB] Running '***/android/platform-tools/adb -P 5037 -s R5CRC3FENRN shell cat /proc/net/unix'
2023-10-05 01:36:58:498 - [debug] [AndroidDriver] Found no active devtools sockets
2023-10-05 01:36:58:498 - [debug] [AndroidDriver] Other sockets are: [
2023-10-05 01:36:58:498 - [debug] [AndroidDriver]   "0000000000000000: 00000002 00000000 00010000 0001 01 30614 @VND_Multiclient2",
2023-10-05 01:36:58:499 - [debug] [AndroidDriver]   "0000000000000000: 00000002 00000000 00010000 0005 01 23190 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
...
@minitouch",
2023-10-05 01:36:58:502 - [debug] [AndroidDriver]   "0000000000000000: 00000003 00000000 00000000 0001 03 79254 @hsdeviceservice"
2023-10-05 01:36:58:502 - [debug] [AndroidDriver] ]
2023-10-05 01:36:58:503 - [debug] [AndroidDriver] Found 0 webviews: []
2023-10-05 01:36:58:503 - [debug] [AndroidDriver] Available contexts: ["NATIVE_APP"]
2023-10-05 01:36:58:504 - [debug] [W3C (046cd22b)] Responding to client with driver.getContexts() result: ["NATIVE_APP"]
2023-10-05 01:36:58:504 - [HTTP] <-- GET /wd/hub/session/046cd22b-cd30-47c5-b8b4-8ec00bfef3e2/contexts 200 75 ms - 24
2023-10-05 04:01:13:661 - [HTTP] --> POST /wd/hub/session/517f36d0-7037-4299-b408-8e465360092c/execute/sync
2023-10-05 04:01:13:661 - [HTTP] {"script":"mobile:getContexts","args":[]}
2023-10-05 04:01:13:666 - [debug] [W3C (517f36d0)] Calling AppiumDriver.execute() with args: ["mobile:getContexts",[],"517f36d0-7037-4299-b408-8e465360092c"]
2023-10-05 04:01:13:666 - [AndroidDriver] Executing native command 'mobile:getContexts'
2023-10-05 04:01:13:667 - [debug] [AndroidDriver] Getting a list of available webviews
2023-10-05 04:01:13:667 - [debug] [ADB] Running '***/android/platform-tools/adb -P 5037 -s R5CRC3FENRN shell cat /proc/net/unix'
2023-10-05 04:01:13:726 - [debug] [AndroidDriver] Found no active devtools sockets
2023-10-05 04:01:13:727 - [debug] [AndroidDriver] Other sockets are: [
2023-10-05 04:01:13:727 - [debug] [AndroidDriver]   "0000000000000000: 00000002 00000000 00010000 0001 01 30614 @VND_Multiclient2",
2023-10-05 04:01:13:727 - [debug] [AndroidDriver]   "0000000000000000: 00000002 00000000 00010000 0005 01 23190 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
...
2023-10-05 04:01:13:730 - [debug] [AndroidDriver]   "0000000000000000: 00000003 00000000 00000000 0005 03   933 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@",
2023-10-05 04:01:13:730 - [debug] [AndroidDriver]   "0000000000000000: 00000003 00000000 00000000 0001 03 35050 @chimera",
2023-10-05 04:01:13:730 - [debug] [AndroidDriver]   "0000000000000000: 00000003 00000000 00000000 0005 03 53413 @jdwp-control",
2023-10-05 04:01:13:730 - [debug] [AndroidDriver]   "0000000000000000: 00000003 00000000 00000000 0005 03 604261 @jdwp-control",
2023-10-05 04:01:13:730 - [debug] [AndroidDriver]   "0000000000000000: 00000003 00000000 00000000 0001 03 87192 @minitouch",
2023-10-05 04:01:13:730 - [debug] [AndroidDriver]   "0000000000000000: 00000003 00000000 00000000 0001 03 79254 @hsdeviceservice"
2023-10-05 04:01:13:730 - [debug] [AndroidDriver] ]
2023-10-05 04:01:13:733 - [debug] [W3C (517f36d0)] Responding to client with driver.execute() result: []
2023-10-05 04:01:13:734 - [HTTP] <-- POST /wd/hub/session/517f36d0-7037-4299-b408-8e465360092c/execute/sync 200 72 ms - 12

To be honest, I don't have good source to show how often this "slowness" to get chrome_devtools_remote behavior occur, but I feel kind of increasing chrome session start failure by this in recent weeks than before.
This chrome_devtools_remote finding in chromedriver's adbd log (like adbd : failed to connect to socket 'localabstract:chrome_devtools_remote': could not connect to localabstract address 'localabstract:chrome_devtools_remote') also feel increasing.

The worst case was chrome browser did not open the socket. The session should terminate the app process once, and restart, then get the context...

Describe the solution you'd like
A clear and concise description of what you want to happen.

try to get chrome_devtools_remote up to the given timeout

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Calls driver.available_contexts in the client side up to XXX seconds

Additional context
Add any other context or screenshots about the feature request here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement feature Mobile Chrome related to mobile Chrome driver
Projects
None yet
2 participants