appium-inspector icon indicating copy to clipboard operation
appium-inspector copied to clipboard

Can not select expected webview from android

Open HamburgerZ opened this issue 2 years ago • 6 comments

Appium or Appium Desktop?

You are reporting an issue at the Appium Desktop repository. Appium Desktop is a wrapper around Appium. If you are having trouble running tests, it is much more likely that the problem you are encountering is not a problem with Appium Desktop but with Appium. For that reason we require you to have tried your testcase with Appium CLI before reporting issues. Check the checkbox below to confirm that you have proven your issue does not reproduce on Appium itself:

  • [x] I have verified that my issue does not occur with Appium and should be investigated as an Appium Desktop issue

The problem

I am viewing a page on android via appium-inspector. I select a webview in appium-inspector. The name of the selected webview is "百度一下". At this point it will automatically fill in another webview. The name of the webview to be filled in is "搜一搜".

1

2

I suspect that the request method of appium-inspector is wrong.

appium-server-logs.txt

Android environment: There is a process called "com.tencent.mm:toolsmp" on android. Its PID on android is 14919. The process has multiple webviews. (It is normal for a process to have multiple webviews)

Thanks.

Environment

  • I am running Appium Desktop version .
  • I am on (pick one):
    • [ ] Mac
    • [x] Windows
    • [ ] Linux

App Version: 2022.5.1 Electron: 13.6.9 Node.js: 14.16.0

HamburgerZ avatar May 14 '22 16:05 HamburgerZ

Is it a custom chrome tab? Perhaps after switching to WebView context, you need to select a proper tab via window_handler since Appium can detect the WebView process, but the process has its own tabs/windows handler by chrome. e.g. https://github.com/appium/appium/issues/16031#issuecomment-958645556

KazuCocoa avatar May 15 '22 21:05 KazuCocoa

hm, no. It seems like the chromedriver failed to establish a session(?)

appium-desktop/node_modules/appium/node_modules/appium-chromedriver/chromedriver/win/chromedriver_win32_v86.0.4240.22.exe --url-base=wd/hub --port=8001 --adb-port=5037 --verbose
[debug] [35m[Chromedriver][39m Chromedriver version: '86.0.4240.22'
[debug] [35m[WD Proxy][39m Matched '/status' to command name 'getStatus'
[debug] [35m[WD Proxy][39m Proxying [GET /status] to [GET http://127.0.0.1:8001/wd/hub/status] with no body[debug] [35m[WD Proxy][39m Got response with status 200: {"value":{"build":{"version":"86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Windows NT","version":"10.0.19043"},"ready":true}}
[info] [35m[Chromedriver][39m Starting W3C Chromedriver session with capabilities: {
[info] [35m[Chromedriver][39m   "capabilities": {
[info] [35m[Chromedriver][39m     "alwaysMatch": {
[info] [35m[Chromedriver][39m       "goog:chromeOptions": {
[info] [35m[Chromedriver][39m         "androidUseRunningApp": true,
[info] [35m[Chromedriver][39m         "androidProcess": "com.tencent.mm:toolsmp",
[info] [35m[Chromedriver][39m         "androidDeviceSerial": "6250b651"
[info] [35m[Chromedriver][39m       },
[info] [35m[Chromedriver][39m       "goog:loggingPrefs": {
[info] [35m[Chromedriver][39m         "browser": "ALL"
[info] [35m[Chromedriver][39m       }
[info] [35m[Chromedriver][39m     }
[info] [35m[Chromedriver][39m   }
[info] [35m[Chromedriver][39m }
[debug] [35m[WD Proxy][39m Matched '/session' to command name 'createSession'
[debug] [35m[WD Proxy][39m Proxying [POST /session] to [POST http://127.0.0.1:8001/wd/hub/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidUseRunningApp":true,"androidProcess":"com.tencent.mm:toolsmp","androidDeviceSerial":"6250b651"},"goog:loggingPrefs":{"browser":"ALL"}}}}[error] [35m[Chromedriver][39m Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] [35m[Chromedriver][39m Changed state to 'stopped'
[error] [35m[Chromedriver][39m invalid argument: cannot parse capability: goog:chromeOptions
[error] [35m[Chromedriver][39m from invalid argument: unrecognized chrome option: androidDeviceSerial
[debug] [35m[MJSONWP (6b4dcc51)][39m Encountered internal error running command: Error: invalid argument: cannot parse capability: goog:chromeOptions
[debug] [35m[MJSONWP (6b4dcc51)][39m from invalid argument: unrecognized chrome option: androidDeviceSerial
[debug] [35m[MJSONWP (6b4dcc51)][39m     at Object.errorAndThrow (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-support\lib\logging.js:94:35)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at Chromedriver.start (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:541:11)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AndroidUiautomator2Driver.setupNewChromedriver (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:472:3)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AndroidUiautomator2Driver.startChromedriverProxy (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:221:10)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AndroidUiautomator2Driver.switchContext (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:128:5)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AndroidUiautomator2Driver.setContext (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:54:3)
[debug] [35m[MJSONWP (6b4dcc51)][39m From previous event:
[debug] [35m[MJSONWP (6b4dcc51)][39m     at commandExecutor (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:334:17)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:146:12
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AsyncLock._promiseTry (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:280:31)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at exec (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:145:9)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AsyncLock.acquire (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:162:3)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AndroidUiautomator2Driver.executeCommand (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:348:39)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at AppiumDriver.executeCommand (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\lib\appium.js:563:36)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at processTicksAndRejections (internal/process/task_queues.js:97:5)
[debug] [35m[MJSONWP (6b4dcc51)][39m     at asyncHandler (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:297:21)
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/6b4dcc51-1789-4704-a477-c04d70b7ef44/context [39m[31m500[39m [90m5906 ms - 304[39m
[info] [35m[HTTP][39m [90m[39m

KazuCocoa avatar May 15 '22 22:05 KazuCocoa

Could you try out the latest uia2 driver (over appium2), or set goog:chromeOptions: {'androidPackage': 'com.tencent.mm'} as the capability?

KazuCocoa avatar May 15 '22 23:05 KazuCocoa

There is a process called “WEBVIEW_com.tencent.toolsmap”. It have two socketName like '@webview_remote_devtools_14919' and '@xweb_remote_devtools_14919', when I setContext by "WEBVIEW_com.tencent.toolsmap", which socketName was selected?Can I customize the socketName?

HamburgerZ avatar May 22 '22 14:05 HamburgerZ

2 There is a problem. '@webview_remote_devtools_14919' corresponding to the browser with version 87.0,and '@xweb_remote_devtools_14919' corresponding to the browser with version 86.0,so the context called “WEBVIEW_com.tencent.toolsmap” have windows from diffrent browser, so there are some windows that we can not swith to. I need some help. Thanks a lot. @KazuCocoa

HamburgerZ avatar May 22 '22 14:05 HamburgerZ

hm, no. It seems like the chromedriver failed to establish a session(?)

appium-desktop/node_modules/appium/node_modules/appium-chromedriver/chromedriver/win/chromedriver_win32_v86.0.4240.22.exe --url-base=wd/hub --port=8001 --adb-port=5037 --verbose
[debug] �[35m[Chromedriver]�[39m Chromedriver version: '86.0.4240.22'
[debug] �[35m[WD Proxy]�[39m Matched '/status' to command name 'getStatus'
[debug] �[35m[WD Proxy]�[39m Proxying [GET /status] to [GET http://127.0.0.1:8001/wd/hub/status] with no body[debug] �[35m[WD Proxy]�[39m Got response with status 200: {"value":{"build":{"version":"86.0.4240.22 (398b0743353ff36fb1b82468f63a3a93b4e2e89e-refs/branch-heads/4240@{#378})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Windows NT","version":"10.0.19043"},"ready":true}}
[info] �[35m[Chromedriver]�[39m Starting W3C Chromedriver session with capabilities: {
[info] �[35m[Chromedriver]�[39m   "capabilities": {
[info] �[35m[Chromedriver]�[39m     "alwaysMatch": {
[info] �[35m[Chromedriver]�[39m       "goog:chromeOptions": {
[info] �[35m[Chromedriver]�[39m         "androidUseRunningApp": true,
[info] �[35m[Chromedriver]�[39m         "androidProcess": "com.tencent.mm:toolsmp",
[info] �[35m[Chromedriver]�[39m         "androidDeviceSerial": "6250b651"
[info] �[35m[Chromedriver]�[39m       },
[info] �[35m[Chromedriver]�[39m       "goog:loggingPrefs": {
[info] �[35m[Chromedriver]�[39m         "browser": "ALL"
[info] �[35m[Chromedriver]�[39m       }
[info] �[35m[Chromedriver]�[39m     }
[info] �[35m[Chromedriver]�[39m   }
[info] �[35m[Chromedriver]�[39m }
[debug] �[35m[WD Proxy]�[39m Matched '/session' to command name 'createSession'
[debug] �[35m[WD Proxy]�[39m Proxying [POST /session] to [POST http://127.0.0.1:8001/wd/hub/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidUseRunningApp":true,"androidProcess":"com.tencent.mm:toolsmp","androidDeviceSerial":"6250b651"},"goog:loggingPrefs":{"browser":"ALL"}}}}[error] �[35m[Chromedriver]�[39m Chromedriver exited unexpectedly with code null, signal SIGTERM
[debug] �[35m[Chromedriver]�[39m Changed state to 'stopped'
[error] �[35m[Chromedriver]�[39m invalid argument: cannot parse capability: goog:chromeOptions
[error] �[35m[Chromedriver]�[39m from invalid argument: unrecognized chrome option: androidDeviceSerial
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m Encountered internal error running command: Error: invalid argument: cannot parse capability: goog:chromeOptions
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m from invalid argument: unrecognized chrome option: androidDeviceSerial
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at Object.errorAndThrow (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-support\lib\logging.js:94:35)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at Chromedriver.start (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:541:11)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AndroidUiautomator2Driver.setupNewChromedriver (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:472:3)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AndroidUiautomator2Driver.startChromedriverProxy (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:221:10)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AndroidUiautomator2Driver.switchContext (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:128:5)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AndroidUiautomator2Driver.setContext (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-android-driver\lib\commands\context.js:54:3)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m From previous event:
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at commandExecutor (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:334:17)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:146:12
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AsyncLock._promiseTry (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:280:31)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at exec (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:145:9)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AsyncLock.acquire (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\async-lock\lib\index.js:162:3)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AndroidUiautomator2Driver.executeCommand (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-base-driver\lib\basedriver\driver.js:348:39)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at AppiumDriver.executeCommand (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\lib\appium.js:563:36)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at processTicksAndRejections (internal/process/task_queues.js:97:5)
[debug] �[35m[MJSONWP (6b4dcc51)]�[39m     at asyncHandler (E:\ham-工作\mystudy\其他\github2\appium-desktop\node_modules\appium\node_modules\appium-base-driver\lib\protocol\protocol.js:297:21)
[info] �[35m[HTTP]�[39m �[37m<-- POST /wd/hub/session/6b4dcc51-1789-4704-a477-c04d70b7ef44/context �[39m�[31m500�[39m �[90m5906 ms - 304�[39m
[info] �[35m[HTTP]�[39m �[90m�[39m

Thanks a lot. This bug has been fixed. This may not be related to my question. https://github.com/appium/appium/issues/16514

HamburgerZ avatar May 23 '22 05:05 HamburgerZ

Did the above fix resolve this issue? I will close this for now, but will reopen if the issue is still relevant.

eglitise avatar May 26 '23 06:05 eglitise