切换webview报错Failed to start Chromedriver session: Failed to get sockets matching: @weblayer_devtools_remote_.*4738

def switch_to_webview_wx(self):
# context = 'WEBVIEW_com.tencent.mm:tools'
context = 'WEBVIEW_com.tencent.mm:toolsmp'
self.__switch_to(context)
time.sleep(3) # 切换至H5页面是多线程操作,需要等待一段时间。再对H5页面操作。
self.__sel_handle()

在切换 webview的时候,抛异常,之前在用的 context是:WEBVIEW_com.tencent.mm:tools,后来变成了 WEBVIEW_com.tencent.mm:toolsmp

只修改 context的值,还是一样的报错,看到日志中有加载 "androidProcess": "com.tencent.mm:tools", 

修改 desired_caps,为  "androidProcess": "com.tencent.mm:toolsmp", 就成功了

 

"appPackage"      :   "com.tencent.mm",
"appActivity" : ".ui.LauncherUI",
"app" : "",
"noReset" : true,
"fullReset" : false,
"noSign" : true,
"unicodeKeyboard" : true,
"resetKeyboard" : true,
"skipServerInstallation" : true,
"skipDeviceInitialization" : true,
"chromedriverExecutableDir" : "\\res\\chromedriver\\",
"chromedriverChromeMappingFile" : "\\res\\chromedriver\\chromedriver.json",
"chromeOptions" : {
"androidProcess" : "com.tencent.mm:toolsmp"
}

 

 1 [Chromedriver] Attempting to use Chromedriver-Chrome mapping from 'D:\jiaolt\A_SVN_AUTO\auto_mwp\auto_mwp\res\chromedriver\chromedriver.json'
 2 [Chromedriver] No file found at 'D:\jiaolt\A_SVN_AUTO\auto_mwp\auto_mwp\res\chromedriver\chromedriver.json'. Using default mapping
 3 [Chromedriver] Found 4 executables in 'D:\jiaolt\A_SVN_AUTO\auto_mwp\auto_mwp\res\chromedriver\'
 4 [Chromedriver] Cannot retrieve version number from 'readme.md' Chromedriver binary. Make sure it returns a valid version string in response to '--version' command line argument. spawn UNKNOWN
 5 [Chromedriver] The following Chromedriver executables were found:
 6 [Chromedriver]     'D:/jiaolt/A_SVN_AUTO/auto_mwp/auto_mwp/res/chromedriver/chromedriver89.exe' (version '89.0.4389.23', minimum Chrome version 'Unknown')
 7 [Chromedriver]     'D:/jiaolt/A_SVN_AUTO/auto_mwp/auto_mwp/res/chromedriver/chromedriver_77_0_3865_40.exe' (version '77.0.3865.40', minimum Chrome version 'Unknown')
 8 [Chromedriver]     'D:/jiaolt/A_SVN_AUTO/auto_mwp/auto_mwp/res/chromedriver/chromedriver_74_0_3729_6_AN9_P30 .exe' (version '74.0.3729.6', minimum Chrome version '74.0.3729')
 9 [ADB] Getting package info for 'com.android.chrome'
10 [ADB] Running 'D:\tools\Android\android_sdk\platform-tools\adb.exe -P 5037 -s 3fc24606 shell dumpsys package com.android.chrome'
11 [Chromedriver] Unable to discover Chrome version. Using Chromedriver 89.0.4389.23 at 'D:/jiaolt/A_SVN_AUTO/auto_mwp/auto_mwp/res/chromedriver/chromedriver89.exe'
12 [Chromedriver] Set chromedriver binary as: D:/jiaolt/A_SVN_AUTO/auto_mwp/auto_mwp/res/chromedriver/chromedriver89.exe
13 [Chromedriver] Killing any old chromedrivers, running: wmic process where "commandline like '%chromedriver.exe%--port=8000%'" delete
14 [Chromedriver] Successfully cleaned up old chromedrivers
15 [Chromedriver] Cleaning any old adb forwarded port socket connections
16 [ADB] List forwarding ports
17 [ADB] Running 'D:\tools\Android\android_sdk\platform-tools\adb.exe -P 5037 -s 3fc24606 forward --list'
18 [Chromedriver] Spawning chromedriver with: D:/jiaolt/A_SVN_AUTO/auto_mwp/auto_mwp/res/chromedriver/chromedriver89.exe --url-base=wd/hub --port=8000 --adb-port=5037 --verbose
19 [Chromedriver] Chromedriver version: '89.0.4389.23'
20 [WD Proxy] Matched '/status' to command name 'getStatus'
21 [WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
22 [WD Proxy] Got response with status 200: {"value":{"build":{"version":"89.0.4389.23 (61b08ee2c50024bab004e48d2b1b083cdbdac579-refs/branch-heads/4389@{#294})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Windows NT","version":"6.1.7601 SP1"},"ready":true}}
23 [Chromedriver] Starting W3C Chromedriver session with capabilities: {
24 [Chromedriver]   "capabilities": {
25 [Chromedriver]     "alwaysMatch": {
26 [Chromedriver]       "goog:chromeOptions": {
27 [Chromedriver]         "androidPackage": "com.tencent.mm",
28 [Chromedriver]         "androidUseRunningApp": true,
29 [Chromedriver]         "androidProcess": "com.tencent.mm:tools",
30 [Chromedriver]         "androidDeviceSerial": "3fc24606"
31 [Chromedriver]       },
32 [Chromedriver]       "goog:loggingPrefs": {
33 [Chromedriver]         "browser": "ALL"
34 [Chromedriver]       }
35 [Chromedriver]     }
36 [Chromedriver]   }
37 [Chromedriver] }
38 [WD Proxy] Matched '/session' to command name 'createSession'
39 [WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"capabilities":{"alwaysMatch":{"goog:chromeOptions":{"androidPackage":"com.tencent.mm","androidUseRunningApp":true,"androidProcess":"com.tencent.mm:tools","androidDeviceSerial":"3fc24606"},"goog:loggingPrefs":{"browser":"ALL"}}}}
40 [WD Proxy] Got an unexpected response with status 500: {"value":{"error":"unknown error","message":"unknown error: Failed to get sockets matching: @weblayer_devtools_remote_.*4738\n  (make sure the app has its WebView/WebLayer configured for debugging)","stacktrace":"Backtrace:\n\tOrdinal0 [0x0018E7D3+124883]\n\tOrdinal0 [0x0018E7B1+124849]\n\tGetHandleVerifier [0x003D8688+193832]\n\tGetHandleVerifier [0x003C1DCE+101486]\n\tGetHandleVerifier [0x003C93BA+131674]\n\tGetHandleVerifier [0x003C8DF4+130196]\n\tGetHandleVerifier [0x003EE860+284416]\n\tGetHandleVerifier [0x003EE035+282325]\n\tGetHandleVerifier [0x00414A90+440624]\n\tGetHandleVerifier [0x004147FC+439964]\n\tGetHandleVerifier [0x0041154B+426987]\n\tGetHandleVerifier [0x003F4FFD+310941]\n\tGetHandleVerifier [0x003F5D8E+314414]\n\tGetHandleVerifier [0x003F5D19+314297]\n\tGetHandleVerifier [0x004B31EC+1089676]\n\tGetHandleVerifier [0x004B17C9+1082985]\n\tGetHandleVerifier [0x004B13A3+1081923]\n\tGetHandleVerifier [0x005AD9FD+2115741]\n\tOrdinal0 [0x002DB82E+1488942]\n\tOrdinal0 [0x00275A7D+1071741]\n\tOrdi...
41 [W3C] Matched W3C error code 'unknown error' to UnknownError
42 [Chromedriver] Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to get sockets matching: @weblayer_devtools_remote_.*4738
43 [Chromedriver]   (make sure the app has its WebView/WebLayer configured for debugging)

 

posted @ 2022-01-25 11:32  小晓风  阅读(922)  评论(0编辑  收藏  举报