首页 > 解决方案 > Appium 与 A​​ndroid 模拟器代理问题

问题描述

我正在尝试使用 Appium 在 Android Mobile Chrome 浏览器中自动进行网站测试,但出现网络错误并且无法访问该网站。

我的电脑在公司代理下,由 PAC 脚本和 VPN 管理。

设置:

在http://127.0.0.1:4723/wd/hub上运行的 Appium 1.21.0 (exe)

安卓工作室 AVD

在 Emulator 代理设置为使用 Android Studio HTTP 代理,自动检测代理设置。

司机:

DesiredCapabilities capabilities = new DesiredCapabilities();
                         capabilities.setCapability("device","Android");
                         capabilities.setCapability("appiumVersion", "1.21.0");
                            capabilities.setCapability("deviceName","Pixel_3a_API_30_x86");
                            capabilities.setCapability("platformName","Android");
                            capabilities.setCapability("platformVersion", "11.0");
                            capabilities.setCapability(CapabilityType.BROWSER_NAME, "Chrome");
                            capabilities.setCapability(CapabilityType.BROWSER_VERSION, "90");
                        driver = new AndroidDriver<MobileElement>(new 
                                 URL("http://127.0.0.1:4723/wd/hub"),capabilities);

控制台日志:

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. Original error: Could not proxy. Proxy error: New Command Timeout of 60 seconds expired. Try customizing the timeout using the 'newCommandTimeout' desired capability
Build info: version: '3.141.59', revision: 'e82be7d358', time: '2018-11-14T08:17:03'
System info: host: 'VIRC5CG0149D6T', ip: '10.66.212.10', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_201'
Driver info: io.appium.java_client.android.AndroidDriver
Capabilities {appActivity: com.google.android.apps.chr..., appPackage: com.android.chrome, appiumVersion: 1.21.0, browserName: Chrome, browserVersion: 90, databaseEnabled: false, desired: {appiumVersion: 1.21.0, browserName: Chrome, browserVersion: 90, device: Android, deviceName: Pixel_3a_API_30_x86, platformName: android, platformVersion: 11.0}, device: Android, deviceApiLevel: 30, deviceManufacturer: Google, deviceModel: sdk_gphone_x86_arm, deviceName: emulator-5554, deviceScreenDensity: 440, deviceScreenSize: 1080x2220, deviceUDID: emulator-5554, javascriptEnabled: true, locationContextEnabled: false, networkConnectionEnabled: true, pixelRatio: 2.75, platform: LINUX, platformName: Android, platformVersion: 11, statBarHeight: 66, takesScreenshot: true, viewportRect: {height: 2022, left: 0, top: 66, width: 1080}, warnings: {}, webStorageEnabled: false}
Session ID: 86edde0e-a9fc-4e71-ab8b-f931820bdea0

Appium日志:

[debug] [35m[BaseDriver][39m Creating session with W3C capabilities: {
[debug] [35m[BaseDriver][39m   "alwaysMatch": {
[debug] [35m[BaseDriver][39m     "appium:appiumVersion": "1.21.0",
[debug] [35m[BaseDriver][39m     "browserName": "Chrome",
[debug] [35m[BaseDriver][39m     "browserVersion": "83",
[debug] [35m[BaseDriver][39m     "appium:device": "Android",
[debug] [35m[BaseDriver][39m     "platformName": "android",
[debug] [35m[BaseDriver][39m     "appium:deviceName": "Pixel_3a_API_30_x86",
[debug] [35m[BaseDriver][39m     "appium:platformVersion": "11.0"
[debug] [35m[BaseDriver][39m   },
[debug] [35m[BaseDriver][39m   "firstMatch": [
[debug] [35m[BaseDriver][39m     {}
[debug] [35m[BaseDriver][39m   ]
[debug] [35m[BaseDriver][39m }
[warn] [35m[BaseDriver][39m The following capabilities were provided, but are not recognized by Appium:
[warn] [35m[BaseDriver][39m   browserVersion
[warn] [35m[BaseDriver][39m   appiumVersion
[info] [35m[BaseDriver][39m Session created with session id: b58995e6-e1ad-477a-b7d1-a1087ebef0a2
[info] [35m[UiAutomator2][39m We're going to run a Chrome-based session
[info] [35m[UiAutomator2][39m Chrome-type package and activity are com.android.chrome and com.google.android.apps.chrome.Main


[info] [35m[AndroidDriver][39m Using device: emulator-5554
[info] [35m[ADB][39m Using 'adb.exe' from 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe'
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 start-server'
[debug] [35m[ADB][39m Setting device id to emulator-5554
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.sdk'[debug] [35m[ADB][39m Current device property 'ro.build.version.sdk': 30
[info] [35m[ADB][39m Getting device platform version
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell getprop ro.build.version.release'
[debug] [35m[ADB][39m Current device property 'ro.build.version.release': 11
'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 wait-for-device'[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell echo ping'
[debug] [35m[AndroidDriver][39m Pushing settings apk to device...
[debug] [35m[ADB][39m Getting install status for io.appium.settings
'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell 'pgrep --help; echo $?''
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pgrep -f \(\[\[:blank:\]\]\|\^\)io\.appium\.settings\(\[\[:blank:\]\]\|\$\)'[debug] [35m[AndroidDriver][39m io.appium.settings is already running. There is no need to reset its permissions.
[debug] [35m[Logcat][39m Starting logs capture with command: C:\\Users\\smtripat\\AppData\\Local\\Android\\Sdk\\platform-tools\\adb.exe -P 5037 -s emulator-5554 logcat -v threadtime[debug] [35m[UiAutomator2][39m Forwarding UiAutomator2 Server port 6790 to local port 8200
[debug] [35m[ADB][39m Forwarding system: 8200 to device: 6790
[debug] [35m[ADB][39m Running 
[debug] [35m[ADB][39m Checking app cert for C:\Users\smtripat\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.21.1.apk
[info] [35m[ADB][39m Using 'apksigner.jar' from 'C:\Users\smtripat\AppData\Local\Android\Sdk\build-tools\30.0.3\lib\apksigner.jar'
[debug] [35m[ADB][39m Starting apksigner: 'C:\\Program Files\\Java\\jdk1.8.0_131\\bin\\java.exe' -Xmx1024M -Xss1m -jar C:\\Users\\smtripat\\AppData\\Local\\Android\\Sdk\\build-tools\\30.0.3\\lib\\apksigner.jar verify --print-certs C:\\Users\\smtripat\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-v4.21.1.apk[debug] 
[debug] [35m[ADB][39m Starting apksigner: 'C:\\Program Files\\Java\\jdk1.8.0_131\\bin\\java.exe' -Xmx1024M -Xss1m -jar C:\\Users\\smtripat\\AppData\\Local\\Android\\Sdk\\build-tools\\30.0.3\\lib\\apksigner.jar verify --print-certs C:\\Users\\smtripat\\AppData\\Local\\Programs\\Appium\\resources\\app\\node_modules\\appium\\node_modules\\appium-uiautomator2-server\\apks\\appium-uiautomator2-server-debug-androidTest.apk[debug] [35m[ADB][39m apksigner stdout: Signer #1 certificate DN: EMAILADDRESS=android@android.com, CN=Android, OU=Android, O=Android, L=Mountain View, ST=California, C=US
[debug] [35m[ADB][39m Signer #1 certificate SHA-256 digest: a40da80a59d170caa950cf15c18c454d47a39b26989d8b640ecd745ba71bf5dc
[debug] [35m[ADB][39m Signer #1 certificate SHA-1 digest: 61ed377e85d386a8dfee6b864bd85b0bfaa5af81
[debug] [35m[ADB][39m Signer #1 certificate MD5 digest: e89b158e4bcf988ebd09eb83f5378e87
["io.appium.settings","io.appium.uiautomator2.server","io.appium.uiautomator2.server.test"] to Doze whitelist
[debug] [35m[ADB][39m Got the following command chunks to execute: [["dumpsys","deviceidle","whitelist","+io.appium.settings",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server",";","dumpsys","deviceidle","whitelist","+io.appium.uiautomator2.server.test",";"]]
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys deviceidle whitelist +io.appium.settings ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server ; dumpsys deviceidle whitelist +io.appium.uiautomator2.server.test ;'[debug] [35m[UiAutomator2][39m No app capability. Assuming it is already on the device
[debug] [35m[ADB][39m Getting install status for com.android.chrome
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package com.android.chrome'[debug] [35m[ADB][39m 'com.android.chrome' is installed
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop com.android.chrome'
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell pm clear com.android.chrome'[debug] [35m[AndroidDriver][39m Performed fast reset on the installed 'com.android.chrome' application (stop and clear)
[debug] [35m[UiAutomator2][39m Performing shallow cleanup of automation leftovers
[debug] [35m[UiAutomator2][39m No obsolete sessions have been detected (socket hang up)
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell am force-stop io.appium.uiautomator2.server.test'[info] [35m[UiAutomator2][39m Starting UIAutomator2 server 4.21.1
[info] [35m[UiAutomator2][39m Using UIAutomator2 server from 'C:\Users\smtripat\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-v4.21.1.apk' and test from 'C:\Users\smtripat\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-uiautomator2-server\apks\appium-uiautomator2-server-debug-androidTest.apk'
[info] [35m[UiAutomator2][39m Waiting up to 30000ms for UiAutomator2 to be online...
[debug] [35m[ADB][39m Creating ADB subprocess with args: ["-P",5037,"-s","emulator-5554","shell","am","instrument","-w","-e","disableAnalytics",true,"io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner"]
[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:8200/wd/hub/status] with no body
[info] [35m[WD Proxy][39m socket hang up[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:8200/wd/hub/status] with no body
[info] [35m[WD Proxy][39m socket hang up[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:8200/wd/hub/status] with no body
[info] [35m[WD Proxy][39m socket hang up
[debug] [35m[Instrumentation][39m io.appium.uiautomator2.server.test.AppiumUiAutomator2Server:[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:8200/wd/hub/status] with no body
[info] [35m[WD Proxy][39m socket hang up[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:8200/wd/hub/status] with no body
[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"None","value":{"message":"UiAutomator2 Server is ready to accept commands","ready":true}}
[debug] [35m[UiAutomator2][39m The initialization of the instrumentation process took 4185ms
[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:8200/wd/hub/session] with body: {"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"browserName":"Chrome","browserVersion":"83","platformName":"android","appiumVersion":"1.21.0","device":"Android","deviceName":"Pixel_3a_API_30_x86","platformVersion":"11.0"},"browserName":"Chrome","browserVersion":"83","platformName":"android","appiumVersion":"1.21.0","device":"Android","deviceName":"emulator-5554","platformVersion":"11.0","appPackage":"com.android.chrome","appActivity":"com.google.android.apps.chrome.Main","deviceUDID":"emulator-5554"}],"alwaysMatch":{}}}
[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"83fc02b0-8571-4d8d-bbef-9f657662004d","value":{"capabilities":{"firstMatch":[{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"browserName":"Chrome","browserVersion":"83","platformName":"android","appiumVersion":"1.21.0","device":"Android","deviceName":"Pixel_3a_API_30_x86","platformVersion":"11.0"},"browserName":"Chrome","browserVersion":"83","platformName":"android","appiumVersion":"1.21.0","device":"Android","deviceName":"emulator-5554","platformVersion":"11.0","appPackage":"com.android.chrome","appActivity":"com.google.android.apps.chrome.Main","deviceUDID":"emulator-5554"}],"alwaysMatch":{}},"sessionId":"83fc02b0-8571-4d8d-bbef-9f657662004d"}}
[info] [35m[WD Proxy][39m Determined the downstream protocol as 'W3C'
[debug] [35m[WD Proxy][39m Proxying [GET /appium/device/info] to [GET http://127.0.0.1:8200/wd/hub/session/83fc02b0-8571-4d8d-bbef-9f657662004d/appium/device/info] with no body[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"83fc02b0-8571-4d8d-bbef-9f657662004d","value":{"androidId":"8ac880deb347dc69","apiVersion":"30","bluetooth":{"state":"ON"},"brand":"google","carrierName":"Android","displayDensity":440,"locale":"en_US","manufacturer":"Google","model":"sdk_gphone_x86_arm","networks":[{"capabilities":{"SSID":null,"linkDownBandwidthKbps":141000,"linkUpstreamBandwidthKbps":141000,"networkCapabilities":"NET_CAPABILITY_NOT_METERED,NET_CAPABILITY_INTERNET,NET_CAPABILITY_NOT_RESTRICTED,NET_CAPABILITY_TRUSTED,NET_CAPABILITY_NOT_VPN,NET_CAPABILITY_NOT_ROAMING,NET_CAPABILITY_FOREGROUND,NET_CAPABILITY_NOT_CONGESTED,NET_CAPABILITY_NOT_SUSPENDED","signalStrength":-30,"transportTypes":"TRANSPORT_WIFI"},"detailedState":"CONNECTED","extraInfo":"","isAvailable":true,"isConnected":true,"isFailover":false,"isRoaming":false,"state":"CONNECTED","subtype":0,"subtypeName":"","type":1,"typeName":"WIFI"},{"capabilities":{"SSID":null,"linkDownBandwidthKbps":30000,"linkUpstreamBandwidthKbps":15000,"networkCapabilities":"NET_CAPABILITY_M...
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys window'
[info] [35m[AndroidDriver][39m Screen already unlocked, doing nothing
[info] [35m[AndroidDriver][39m Starting a chrome-based browser session
[debug] [35m[AndroidDriver][39m A port was not given, using random free port: 8001
[debug] [35m[AndroidDriver][39m Precalculated Chromedriver capabilities: {
[debug] [35m[AndroidDriver][39m   "androidPackage": "com.android.chrome",
[debug] [35m[AndroidDriver][39m   "androidDeviceSerial": "emulator-5554"
[debug] [35m[AndroidDriver][39m }
[debug] [35m[AndroidDriver][39m Before starting chromedriver, androidPackage is 'com.android.chrome'
[debug] [35m[Chromedriver][39m Changed state to 'starting'
[debug] [35m[Chromedriver][39m Using the static Chromedriver->Chrome mapping
[debug] [35m[Chromedriver][39m The most recent known Chrome version: 89.0.4389
[debug] [35m[Chromedriver][39m Found 2 executables in 'C:\Users\smtripat\AppData\Local\Programs\Appium\resources\app\node_modules\appium\node_modules\appium-chromedriver\chromedriver\win'[debug] [35m[Chromedriver][39m The following Chromedriver executables were found:
[debug] [35m[Chromedriver][39m     'C:/Users/smtripat/AppData/Local/Programs/Appium/resources/app/node_modules/appium/node_modules/appium-chromedriver/chromedriver/win/chromedriver_win32_v89.0.4389.23.exe' (version '89.0.4389.23', minimum Chrome version '89.0.4389')
[debug] [35m[Chromedriver][39m     'C:/Users/smtripat/AppData/Local/Programs/Appium/resources/app/node_modules/appium/node_modules/appium-chromedriver/chromedriver/win/chromedriver.exe' (version '83.0.4103.14', minimum Chrome version '83')
[info] [35m[Chromedriver][39m Found 1 Chromedriver, which is missing in the list of known versions: {"83.0.4103.14":"83"}
[debug] [35m[ADB][39m Getting package info for 'com.android.chrome'
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 shell dumpsys package com.android.chrome'[info] [35m[Chromedriver][39m Set chromedriver binary as: C:/Users/smtripat/AppData/Local/Programs/Appium/resources/app/node_modules/appium/node_modules/appium-chromedriver/chromedriver/win/chromedriver.exe
[debug] [35m[Chromedriver][39m Killing any old chromedrivers, running: wmic process where "commandline like '%chromedriver.exe%--port=8001%'" delete[debug] [35m[Chromedriver][39m Successfully cleaned up old chromedrivers
[debug] [35m[Chromedriver][39m Cleaning this device's adb forwarded port socket connections: emulator-5554
[debug] [35m[ADB][39m List forwarding ports
[debug] [35m[ADB][39m Running 'C:\Users\smtripat\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 forward --list'
[info] [35m[Chromedriver][39m Spawning chromedriver with: C:/Users/smtripat/AppData/Local/Programs/Appium/resources/app/node_modules/appium/node_modules/appium-chromedriver/chromedriver/win/chromedriver.exe --url-base=wd/hub --port=8001 --adb-port=5037 --verbose
[debug] [35m[Chromedriver][39m Chromedriver version: '83.0.4103.14'
[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":"83.0.4103.14 (be04594a2b8411758b860104bc0a1033417178be-refs/branch-heads/4103@{#119})"},"message":"ChromeDriver ready for new sessions.","os":{"arch":"x86_64","name":"Windows NT","version":"10.0.19042"},"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         "androidPackage": "com.android.chrome",
[info] [35m[Chromedriver][39m         "androidDeviceSerial": "emulator-5554"
[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":{"androidPackage":"com.android.chrome","androidDeviceSerial":"emulator-5554"},"goog:loggingPrefs":{"browser":"ALL"}}}}[debug] [35m[WD Proxy][39m Got response with status 200: {"value":{"capabilities":{"acceptInsecureCerts":false,"browserName":"chrome","browserVersion":"83.0.4103.106","chrome":{"chromedriverVersion":"83.0.4103.14 (be04594a2b8411758b860104bc0a1033417178be-refs/branch-heads/4103@{#119})"},"goog:chromeOptions":{"debuggerAddress":"localhost:64660"},"pageLoadStrategy":"normal","platformName":"android","proxy":{},"setWindowRect":false,"strictFileInteractability":false,"timeouts":{"implicit":0,"pageLoad":300000,"script":30000},"unhandledPromptBehavior":"dismiss and notify","webauthn:virtualAuthenticators":false},"sessionId":"1e5c9be243820b880113375b22ec11ba"}}
[info] [35m[WD Proxy][39m Determined the downstream protocol as 'W3C'
[debug] [35m[Chromedriver][39m Changed state to 'online'
[debug] [35m[WD Proxy][39m Proxying [GET /appium/device/pixel_ratio] to [GET http://127.0.0.1:8200/wd/hub/session/83fc02b0-8571-4d8d-bbef-9f657662004d/appium/device/pixel_ratio] with no body
[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"83fc02b0-8571-4d8d-bbef-9f657662004d","value":2.75}
[debug] [35m[WD Proxy][39m Matched '/appium/device/system_bars' to command name 'getSystemBars'
[debug] [35m[WD Proxy][39m Proxying [GET /appium/device/system_bars] to [GET http://127.0.0.1:8200/wd/hub/session/83fc02b0-8571-4d8d-bbef-9f657662004d/appium/device/system_bars] with no body
[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"83fc02b0-8571-4d8d-bbef-9f657662004d","value":{"statusBar":66}}
[debug] [35m[WD Proxy][39m Matched '/window/current/size' to command name 'getWindowSize'
[debug] [35m[WD Proxy][39m Proxying [GET /window/current/size] to [GET http://127.0.0.1:8200/wd/hub/session/83fc02b0-8571-4d8d-bbef-9f657662004d/window/current/size] with no body
[debug] [35m[WD Proxy][39m Got response with status 200: {"sessionId":"83fc02b0-8571-4d8d-bbef-9f657662004d","value":{"height":2088,"width":1080}}
[info] [35m[Appium][39m New AndroidUiautomator2Driver session created successfully, session b58995e6-e1ad-477a-b7d1-a1087ebef0a2 added to master session list
[debug] [35m[BaseDriver][39m Event 'newSessionStarted' logged at 1624370616730 (09:03:36 GMT-0500 (Central Daylight Time))
[debug] [35m[W3C (b58995e6)][39m Cached the protocol value 'W3C' for the new session b58995e6-e1ad-477a-b7d1-a1087ebef0a2
[debug] [35m[W3C (b58995e6)][39m Responding to client with driver.createSession() result: {"capabilities":{"platform":"LINUX","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"browserName":"Chrome","browserVersion":"83","platformName":"android","appiumVersion":"1.21.0","device":"Android","deviceName":"Pixel_3a_API_30_x86","platformVersion":"11.0"},"browserName":"Chrome","browserVersion":"83","platformName":"android","appiumVersion":"1.21.0","device":"Android","deviceName":"emulator-5554","platformVersion":"11","appPackage":"com.android.chrome","appActivity":"com.google.android.apps.chrome.Main","deviceUDID":"emulator-5554","deviceApiLevel":30,"deviceScreenSize":"1080x2220","deviceScreenDensity":440,"deviceModel":"sdk_gphone_x86_arm","deviceManufacturer":"Google","pixelRatio":2.75,"statBarHeight":66,"viewportRect":{"left":0,"top":66,"width":1080,"height":2022}}}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session [39m[32m200[39m [90m17633 ms - 981[39m
[info] [35m[HTTP][39m [90m[39m[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/timeouts[39m
[info] [35m[HTTP][39m [90m{"implicit":30000}[39m
[info] [35m[W3C (b58995e6)][39m Driver proxy active, passing request on via HTTP proxy
[debug] [35m[WD Proxy][39m Matched '/wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/timeouts' to command name 'timeouts'
[debug] [35m[Protocol Converter][39m Will send the following request bodies to /timeouts: [{"implicit":30000}]
[debug] [35m[WD Proxy][39m Proxying [POST /wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/timeouts] to [POST http://127.0.0.1:8001/wd/hub/session/1e5c9be243820b880113375b22ec11ba/timeouts] with body: {"implicit":30000}
[debug] [35m[WD Proxy][39m Got response with status 200: {"value":null}
[info] [35m[HTTP][39m [37m<-- POST /wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/timeouts [39m[32m200[39m [90m10 ms - 14[39m
[info] [35m[HTTP][39m [90m[39m
[info] [35m[HTTP][39m [37m-->[39m [37mDELETE[39m [37m/wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/cookie[39m
[info] [35m[HTTP][39m [90m{}[39m
[info] [35m[W3C (b58995e6)][39m Driver proxy active, passing request on via HTTP proxy
[debug] [35m[WD Proxy][39m Matched '/wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/cookie' to command name 'deleteCookies'
[debug] [35m[WD Proxy][39m Proxying [DELETE /wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/cookie] to [DELETE http://127.0.0.1:8001/wd/hub/session/1e5c9be243820b880113375b22ec11ba/cookie] with body: {}
[debug] [35m[WD Proxy][39m Got response with status 200: {"value":null}
[info] [35m[HTTP][39m [37m<-- DELETE /wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/cookie [39m[32m200[39m [90m85 ms - 14[39m
[info] [35m[HTTP][39m [90m[39m[info] [35m[HTTP][39m [37m-->[39m [37mPOST[39m [37m/wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/url[39m
[info] [35m[HTTP][39m [90m{"url":"https://consumer-travel-qa.americanexpress.com"}[39m
[info] [35m[W3C (b58995e6)][39m Driver proxy active, passing request on via HTTP proxy
[debug] [35m[WD Proxy][39m Matched '/wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/url' to command name 'setUrl'
[debug] [35m[WD Proxy][39m Proxying [POST /wd/hub/session/b58995e6-e1ad-477a-b7d1-a1087ebef0a2/url] to [POST 

标签: android-studioappiumappium-android

解决方案


这适用于关闭 wi-fi 并在模拟器中启用 APN


推荐阅读