在Android模拟器中使用Chrome运行Appium测试时,ADB命令超时

时间:2019-04-22 13:15:18

标签: c# android-emulator selenium-chromedriver appium appium-android

在Android模拟器中运行带有chrome的appium测试时,出现“ ADB命令在30秒后超时”错误。

  • Appium桌面-V1.12.1
  • Chrome 69.0.3497.100
  • Chromedriver-V2.43

        dc.SetCapability(MobileCapabilityType.PlatformName, "Android");
        dc.SetCapability(MobileCapabilityType.PlatformVersion, "7.1.1");
        dc.SetCapability(MobileCapabilityType.DeviceName, "Android Emulator");
        dc.SetCapability(MobileCapabilityType.BrowserName, MobileBrowserType.Chrome);
    
    
        dc.SetCapability("adbExecTimeout", 50000);
        dc.SetCapability(MobileCapabilityType.NewCommandTimeout, 50000);
        dc.SetCapability("showChromedriverLog", true);
        dc.SetCapability("noReset", true);
        dc.SetCapability("unicodekeyboard", true);
    
        AndroidDriver<AppiumWebElement> driver = new AndroidDriver<AppiumWebElement>(new Uri("http://127.0.0.1:4723/wd/hub"), dc, TimeSpan.FromSeconds(360));
    

错误日志:

[WD Proxy] Proxying [GET /status] to [GET http://127.0.0.1:8000/wd/hub/status] with no body
[WD Proxy] Got response with status 200: "{\"sessionId\":\"\",\"status\":0,\"value\":{\"build\":{\"version\":\"alpha\"},\"os\":{\"arch\":\"x86_64\",\"name\":\"Windows NT\",\"version\":\"6.1.7601 SP1\"}}}"
[WD Proxy] Matched '/session' to command name 'createSession'
[WD Proxy] Proxying [POST /session] to [POST http://127.0.0.1:8000/wd/hub/session] with body: {"desiredCapabilities":{"chromeOptions":{"androidPackage":"com.android.chrome","androidDeviceSerial":"emulator-5554"},"loggingPrefs":{"browser":"ALL"}}}
[Chromedriver] [STDERR] [1555937773.225][INFO]: [cb8b945e8894382db5b6767f57252605] COMMAND InitSession {
[Chromedriver] [STDERR]    "desiredCapabilities": {
[Chromedriver] [STDERR]       "chromeOptions": {
[Chromedriver] [STDERR]          "androidDeviceSerial": "emulator-5554",
[Chromedriver] [STDERR]          "androidPackage": "com.android.chrome"
[Chromedriver] [STDERR]       },
[Chromedriver] [STDERR]       "loggingPrefs": {
[Chromedriver] [STDERR]          "browser": "ALL"
[Chromedriver] [STDERR]       }
[Chromedriver] [STDERR]    }
[Chromedriver] [STDERR] }
[Chromedriver] [STDERR] [1555937773.225][DEBUG]: Sending adb command: host:devices
[Chromedriver] [STDERR] [1555937773.225][DEBUG]: Received adb response: emulator-5554   device
[Chromedriver] [STDERR] [1555937773.225][DEBUG]: Sending adb command: host:transport:emulator-5554|shell:pm path com.android.chrome
[Chromedriver] [STDERR] [1555937783.150][DEBUG]: Received adb response: package:/data/app/com.android.chrome-1/base.apk
[Chromedriver] [STDERR] [1555937783.150][DEBUG]: Sending adb command: host:transport:emulator-5554|shell:am set-debug-app --persistent com.android.chrome
[Chromedriver] [STDERR] [1555937810.632][DEBUG]: Received adb response: 
[Chromedriver] [STDERR] [1555937810.632][DEBUG]: Sending adb command: host:transport:emulator-5554|shell:pm clear com.android.chrome
[Chromedriver] [STDERR] [1555937840.648][INFO]: [cb8b945e8894382db5b6767f57252605] RESPONSE InitSession ERROR timeout: Adb command timed out after 30 seconds
[Chromedriver] [STDERR] [1555937840.648][DEBUG]: Log type 'driver' lost 0 entries on destruction
[Chromedriver] [STDERR] [1555937840.648][DEBUG]: Log type 'browser' lost 0 entries on destruction
[WD Proxy] Got response with status 200: {"sessionId":"cb8b945e8894382db5b6767f57252605","status":21,"value":{"message":"timeout: Adb command timed out after 30 seconds\n  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 6.1.7601 SP1 x86_64)"}}
[WD Proxy] Got an unexpected response: {"sessionId":"cb8b945e8894382db5b6767f57252605","status":21,"value":{"message":"timeout:<b> Adb command timed out after 30 seconds</b>\n  (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 6.1.7601 SP1 x86_64)"}}
[MJSONWP] Matched JSONWP error code 21 to TimeoutError
[Chromedriver] Error: Failed to start Chromedriver session: timeout: Adb command timed out after 30 seconds
[Chromedriver]   (Driver info: chromedriver=2.43.600210 (68dcf5eebde37173d4027fa8635e332711d2874a),platform=Windows NT 6.1.7601 SP1 x86_64)
[Chromedriver]     at Object.wrappedLogger.errorAndThrow (\\mgm.local\data\data\VMUserProfiles\prabu.rajasekar\desktop\appium-desktop-1.12.1-x64.nsis\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:78:13)
[Chromedriver]     at errorAndThrow (\\mgm.local\data\data\VMUserProfiles\prabu.rajasekar\desktop\appium-desktop-1.12.1-x64.nsis\resources\app\node_modules\appium\node_modules\appium-chromedriver\lib\chromedriver.js:493:13

0 个答案:

没有答案