native 切換 webview 失敗,求大神協助
appium.log 報錯資訊:
[debug] [35m[ADB][39m Running 'D:\Program\andriod\sdk\platform-tools\adb.exe -P 5037 -s B2T0216822004895 shell ps'[debug] [35m[AndroidDriver][39m Parsed pid: '8161' pkg: 'tv.danmaku.bili' from
[debug] [35m[AndroidDriver][39m USER PID PPID VSZ RSS WCHAN ADDR S NAME
[debug] [35m[AndroidDriver][39m u0_a921 8161 731 2495168 237272 0 0 S tv.danmaku.bili
[debug] [35m[AndroidDriver][39m Returning process name: 'tv.danmaku.bili'
[debug] [35m[AndroidDriver][39m Parsed pid: '8839' pkg: 'tv.danmaku.bili:web' from
[debug] [35m[AndroidDriver][39m USER PID PPID VSZ RSS WCHAN ADDR S NAME
[debug] [35m[AndroidDriver][39m u0_a921 8839 731 2448644 257836 0 0 S tv.danmaku.bili:web
[debug] [35m[AndroidDriver][39m Returning process name: 'tv.danmaku.bili:web'
[debug] [35m[AndroidDriver][39m Found webviews: ["WEBVIEW_tv.danmaku.bili","WEBVIEW_stetho_tv.danmaku.bili","WEBVIEW_tv.danmaku.bili:web","WEBVIEW_stetho_tv.danmaku.bili:web"]
[debug] [35m[AndroidDriver][39m Available contexts: ["NATIVE_APP","WEBVIEW_tv.danmaku.bili","WEBVIEW_stetho_tv.danmaku.bili","WEBVIEW_tv.danmaku.bili:web","WEBVIEW_stetho_tv.danmaku.bili:web"]
[debug] [35m[AndroidDriver][39m Connecting to chrome-backed webview context 'WEBVIEW_tv.danmaku.bili:web'
[debug] [35m[AndroidDriver][39m A port was not given, using random free port: 8000
[debug] [35m[AndroidDriver][39m Automated Chromedriver download is disabled. Use 'chromedriver_autodownload' server feature to enable it
[debug] [35m[AndroidDriver][39m Before starting chromedriver, androidPackage is 'tv.danmaku.bili'
[debug] [35m[Chromedriver][39m Changed state to 'starting'
[info] [35m[Chromedriver][39m Set chromedriver binary as: D:\chromedriver\2.44\chromedriver.exe
[debug] [35m[Chromedriver][39m Killing any old chromedrivers, running: wmic process where "commandline like '%chromedriver.exe%--port=8000%'" delete[debug] [35m[Chromedriver][39m Successfully cleaned up old chromedrivers
[debug] [35m[Chromedriver][39m Cleaning any old adb forwarded port socket connections
[debug] [35m[ADB][39m List forwarding ports
[debug] [35m[ADB][39m Running 'D:\Program\andriod\sdk\platform-tools\adb.exe -P 5037 -s B2T0216822004895 forward --list'
[debug] [35m[ADB][39m Removing forwarded port socket connection: 50257
[debug] [35m[ADB][39m Running 'D:\Program\andriod\sdk\platform-tools\adb.exe -P 5037 -s B2T0216822004895 forward --remove tcp:50257'[debug] [35m[ADB][39m Removing forwarded port socket connection: 50303
[debug] [35m[ADB][39m Running 'D:\Program\andriod\sdk\platform-tools\adb.exe -P 5037 -s B2T0216822004895 forward --remove tcp:50303'[debug] [35m[Chromedriver][39m Chromedriver version: '2.44.609538'
[debug] [35m[Chromedriver][39m Chromedriver v. 2.44.609538 does not fully support W3C protocol. Defaulting to MJSONWP
[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:8000/wd/hub/status] with no body[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"","status":0,"value":{"build":{"version":"alpha"},"os":{"arch":"x86_64","name":"Windows NT","version":"10.0.18362"}}}
[info] [35m[Chromedriver][39m Starting MJSONWP Chromedriver session with capabilities: {
[info] [35m[Chromedriver][39m "desiredCapabilities": {
[info] [35m[Chromedriver][39m "chromeOptions": {
[info] [35m[Chromedriver][39m "androidPackage": "tv.danmaku.bili",
[info] [35m[Chromedriver][39m "androidUseRunningApp": true,
[info] [35m[Chromedriver][39m "androidDeviceSerial": "B2T0216822004895"
[info] [35m[Chromedriver][39m },
[info] [35m[Chromedriver][39m "loggingPrefs": {
[info] [35m[Chromedriver][39m "browser": "ALL"
[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:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"tv.danmaku.bili","androidUseRunningApp":true,"androidDeviceSerial":"B2T0216822004895"},"loggingPrefs":{"browser":"ALL"}}}[debug] [35m[Chromedriver][39m Webview version: 'Chrome/69.0.3497.100'[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"3b64ac6dd291a6a0491e45e3f8963014","status":13,"value":{"message":"unknown error: unable to discover open pages\n (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18362 x86_64)"}}
[info] [35m[WD Proxy][39m Determined the downstream protocol as 'MJSONWP'
[info] [35m[WD Proxy][39m The response has an unknown format
[debug] [35m[MJSONWP][39m Matched JSONWP error code 13 to UnknownError
[warn] [35m[Chromedriver][39m Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: unable to discover open pages
[warn] [35m[Chromedriver][39m (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18362 x86_64)[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:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"tv.danmaku.bili","androidUseRunningApp":true,"androidDeviceSerial":"B2T0216822004895"},"loggingPrefs":{"browser":"ALL"}}}[debug] [35m[Chromedriver][39m Webview version: 'Chrome/69.0.3497.100'[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/392974e8-2e74-48c8-a3d2-97672addda8a/context [39m[32m-[39m [90m- ms - -[39m
[info] [35m[HTTP][39m [90m[39m[info] [35m[HTTP][39m [37m-->[39m [37mDELETE[39m [37m/wd/hub/session/392974e8-2e74-48c8-a3d2-97672addda8a[39m
[info] [35m[HTTP][39m [90m{}[39m
[debug] [35m[W3C (392974e8)][39m Calling AppiumDriver.deleteSession() with args: ["392974e8-2e74-48c8-a3d2-97672addda8a"]
[debug] [35m[BaseDriver][39m Event 'quitSessionRequested' logged at 1586244841316 (15:34:01 GMT+0800 (中國標準時間))
[info] [35m[Appium][39m Removing session 392974e8-2e74-48c8-a3d2-97672addda8a from our master session list
[debug] [35m[UiAutomator2][39m Deleting UiAutomator2 session
[debug] [35m[UiAutomator2][39m Deleting UiAutomator2 server session
[debug] [35m[WD Proxy][39m Matched '/' to command name 'deleteSession'
[debug] [35m[WD Proxy][39m Proxying [DELETE /] to [DELETE http://localhost:8200/wd/hub/session/9f9f4b8a-53aa-495a-a41e-2d5118f97369] with no body[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"9f9f4b8a-53aa-495a-a41e-2d5118f97369","value":null}
[debug] [35m[ADB][39m Running 'D:\Program\andriod\sdk\platform-tools\adb.exe -P 5037 -s B2T0216822004895 shell am force-stop tv.danmaku.bili'[debug] [35m[Logcat][39m Stopping logcat capture
[debug] [35m[ADB][39m Removing forwarded port socket connection: 8200
[debug] [35m[ADB][39m Running 'D:\Program\andriod\sdk\platform-tools\adb.exe -P 5037 -s B2T0216822004895 forward --remove tcp:8200'[debug] [35m[BaseDriver][39m Event 'quitSessionFinished' logged at 1586244841862 (15:34:01 GMT+0800 (中國標準時間))
[debug] [35m[W3C (392974e8)][39m Received response: null
[debug] [35m[W3C (392974e8)][39m But deleting session, so not returning
[debug] [35m[W3C (392974e8)][39m Responding to client with driver.deleteSession() result: null
[info] [35m[HTTP][39m [37m<-- DELETE /wd/hub/session/392974e8-2e74-48c8-a3d2-97672addda8a [39m[32m200[39m [90m547 ms - 14[39m
[info] [35m[HTTP][39m [90m[39m
[debug] [35m[Instrumentation][39m .[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"b50c8735d77d7432136584f249a3e32d","status":13,"value":{"message":"unknown error: unable to discover open pages\n (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18362 x86_64)"}}
[info] [35m[WD Proxy][39m Determined the downstream protocol as 'MJSONWP'
[info] [35m[WD Proxy][39m The response has an unknown format
[debug] [35m[MJSONWP][39m Matched JSONWP error code 13 to UnknownError
[warn] [35m[Chromedriver][39m Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: unable to discover open pages
[warn] [35m[Chromedriver][39m (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18362 x86_64)[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:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"tv.danmaku.bili","androidUseRunningApp":true,"androidDeviceSerial":"B2T0216822004895"},"loggingPrefs":{"browser":"ALL"}}}[debug] [35m[Instrumentation][39m Time: 145.291
[debug] [35m[Instrumentation][39m
[debug] [35m[Instrumentation][39m OK (1 test)
[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"7eb1bbf9d5070beea46e5487aa044253","status":13,"value":{"message":"unknown error: Failed to get sockets matching: @webview_devtools_remote_.*9536\n (make sure the app has its WebView configured for debugging)\n (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18362 x86_64)"}}
[info] [35m[WD Proxy][39m Determined the downstream protocol as 'MJSONWP'
[info] [35m[WD Proxy][39m The response has an unknown format
[debug] [35m[MJSONWP][39m Matched JSONWP error code 13 to UnknownError
[warn] [35m[Chromedriver][39m Failed to start Chromedriver session: An unknown server-side error occurred while processing the command. Original error: unknown error: Failed to get sockets matching: @webview_devtools_remote_.*9536
[warn] [35m[Chromedriver][39m (make sure the app has its WebView configured for debugging)
[warn] [35m[Chromedriver][39m (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18362 x86_64)
[debug] [35m[Instrumentation][39m The process has exited with code 0[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:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"tv.danmaku.bili","androidUseRunningApp":true,"androidDeviceSerial":"B2T0216822004895"},"loggingPrefs":{"browser":"ALL"}}}[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"7dd4b9c9edf2f34431f62834af24e0c4","status":13,"value":{"message":"unknown error: Failed to get sockets matching: @webview_devtools_remote_.*9536\n (make sure the app has its WebView configured for debugging)\n (Driver info: chromedriver=2.44.609538 (b655c5a60b0b544917107a59d4153d4bf78e1b90),platform=Windows NT 10.0.18362 x86_64)"}}
[info] [35m[WD Proxy][39m Determined the downstream protocol as 'MJSONWP'
[info] [35m[WD Proxy][39m The response has an unknown format
appium 配置:
def start(cls):
apk_path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
desired_caps = {}
desired_caps['platformName'] = cls.data["platformName"] # 裝置系統
desired_caps['platformVersion'] = cls.data["platformVersion"] # 裝置系統版本6.0.1
desired_caps['deviceName'] = cls.data["deviceName"] # 裝置名稱
desired_caps['udid'] = cls.data["udid"] # 測試app包名
#desired_caps['app'] = apk_path + "\\app\\bilibili_5531000.apk"
desired_caps['appPackage'] = cls.data["appPackage"] # 測試app包名
desired_caps['appActivity'] = cls.data["appActivity"] # 測試appActivity.activity
desired_caps['browserName'] = ''
desired_caps['chromedriverExecutable'] = 'D:\\chromedriver\\2.44\\chromedriver.exe'
desired_caps['autoGrantPermissions'] = True # 預設授權
desired_caps['unicodeKeyboard'] = True
desired_caps['noReset'] = True
desired_caps['ChromeOptions'] = {'androidProcess': 'WEBVIEW_tv.danmaku.bili:web'}
呼叫程式碼:
webview_list = self.driver.contexts
print(webview_list)
# ['NATIVE_APP', 'WEBVIEW_stetho_tv.danmaku.bili', 'WEBVIEW_tv.danmaku.bili:web', 'WEBVIEW_tv.danmaku.bili', 'WEBVIEW_stetho_tv.danmaku.bili:web']
sleep(5)
self.driver.switch_to.context('WEBVIEW_tv.danmaku.bili:web'
pycharm 報錯資訊:
E urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))
相關文章
- DATAGUARD失敗切換
- 探討寶塔切換php版本切換失敗的原因和解決方法PHP
- docker Redis單機主從哨兵模式切換失敗DockerRedis模式
- python+selenium切換彈框的iframe框架失敗處理方法Python框架
- Appium 切換進入 webview,點選元素偏離APPWebView
- React Native 使用 react-native-webview 渲染 HTMLReact NativeWebViewHTML
- 請求OpenFeign的GET請求時,請求為何失敗?
- jenkins 釋出 html report 失敗 (急求)JenkinsHTML
- jwt安裝失敗,求大佬指導下JWT
- 關於微信 H5 頁面切換 webview 的問題H5WebView
- 世紀難題!搞了一個星期也沒弄成,請求大神幫助!
- Appium 關於微信 H5 頁面切換 webview 的問題APPH5WebView
- Vue路由切換 & Axios介面取消重複請求Vue路由iOS
- Java的快速失敗和安全失敗Java
- 求大神怎麼弄菱形
- 快速失敗機制&失敗安全機制
- git push程式碼失敗,鑑權失敗Git
- React Native踩坑指南:WebView高度自適應React NativeWebView
- react native ScrollView巢狀WebView 互動問題React Native巢狀WebView
- 爬蟲中的TCP請求自動切換ip爬蟲TCP
- crmeb系統請求介面超時,超過十秒就請求失敗
- MSSQL-從字串轉換日期和/或時間時,轉換失敗SQL字串
- Composer 失敗
- 程式切換(上下文切換)
- 快速失敗是讓失敗立即快速發生! - pathelland
- Win7 Nginx啟動失敗 cmd命令失敗Win7Nginx
- 解決 Ajax 表單請求驗證失敗報 422 錯誤
- 使用Python請求http/https時設定失敗重試次數PythonHTTP
- Spring Cloud 學習筆記 ——Spring Cloud Config 請求失敗重試SpringCloud筆記
- 以失敗為機制:奇異人生中的真實失敗與虛構性失敗
- npm install 失敗NPM
- npm install失敗NPM
- 如何突破失敗
- git merge失敗Git
- win10退回win7失敗怎麼解決_win10換回win7失敗處理方法Win10Win7
- 把TXT文字匯入SQLServer 出錯:資料轉換失敗SQLServer
- dota2啟動失敗 初始化vulkan失敗
- 解決.NET Core Ajax請求後臺傳送引數過大請求失敗問題