Appium appium_desktop 启动手机谷歌浏览器,自动开启多个窗口,然后报错 executing adbExec

尚酷米 · 2017年12月11日 · 最后由 尚酷米 回复于 2017年12月12日 · 2268 次阅读

配置
1.三星 s6 、 5.0 的系统
2.appium-desktop 1.2.6
3.谷歌浏览器 62

问题
1.使用 appium 启动谷歌浏览器【成功】
2.get 跳转网页时,appium 客户端发送多个请求,使得浏览器打开多个窗口 (实际上浏览器已经打开了百度),最后 timeout【报错】

脚本日志

  File "C:\Program Files\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 323, in get
    self.execute(Command.GET, {'url': url})
  File "C:\Program Files\Python35\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 311, in execute
    self.error_handler.check_response(response)
  File "C:\Program Files\Python35\lib\site-packages\appium\webdriver\errorhandler.py", line 29, in check_response
    raise wde
  File "C:\Program Files\Python35\lib\site-packages\appium\webdriver\errorhandler.py", line 24, in check_response
    super(MobileErrorHandler, self).check_response(response)
  File "C:\Program Files\Python35\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 237, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: An unknown server-side error occurred while processing the command. Original error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'E\:\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s 04157df4704cd01b shell am start -W -a android.intent.action.VIEW -d https\://www.baidu.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'

appium 日志

[HTTP] <-- POST /wd/hub/session 200 35805 ms - 766 
[HTTP] --> POST /wd/hub/session/57c01cea-59ac-4c98-9fa0-ce44b04d7d12/url {"url":"https://www.baidu.com","sessionId":"57c01cea-59ac-4c98-9fa0-ce44b04d7d12"}
[MJSONWP] Calling AppiumDriver.setUrl() with args: ["https://www.baidu.com","57c01cea-59ac-4c98-9fa0-ce44b04d7d12"]
[ADB] Getting connected devices...
[ADB] 1 device(s) connected
[ADB] Running 'E:\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","04157df4704cd01b","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://www.baidu.com","com.android.chrome"]     # 打开第一个百度窗口
[ADB] Running 'E:\android-sdk-windows\platform-tools\adb.exe' with args: ["-P",5037,"-s","04157df4704cd01b","shell","am","start","-W","-a","android.intent.action.VIEW","-d","https://www.baidu.com","com.android.chrome"]      # 打开第二个百度窗口
[ADB] Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'E\:\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s 04157df4704cd01b shell am start -W -a android.intent.action.VIEW -d https\://www.baidu.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
    at Object.wrappedLogger.errorAndThrow (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
    at ADB.callee$0$0$ (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
    at tryCatch (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
 Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'E\:\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s 04157df4704cd01b shell am start -W -a android.intent.action.VIEW -d https\://www.baidu.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
    at Object.wrappedLogger.errorAndThrow (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
    at ADB.callee$0$0$ (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
    at tryCatch (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[MJSONWP] Encountered internal error running command: Error: Error attempting to start URI. Original error: Error: Error executing adbExec. Original error: 'Command 'E\:\\android-sdk-windows\\platform-tools\\adb.exe -P 5037 -s 04157df4704cd01b shell am start -W -a android.intent.action.VIEW -d https\://www.baidu.com com.android.chrome' timed out after 20000ms'; Stderr: ''; Code: 'null'
    at Object.wrappedLogger.errorAndThrow (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-support\lib\logging.js:63:13)
    at ADB.callee$0$0$ (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\appium-adb\lib\tools\apk-utils.js:47:9)
    at tryCatch (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
    at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
    at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
    at GeneratorFunctionPrototype.invoke (C:\Users\acer-pc\AppData\Local\Programs\appium-desktop\resources\app\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)
[HTTP] <-- POST /wd/hub/session/57c01cea-59ac-4c98-9fa0-ce44b04d7d12/url 500 40237 ms - 506 

脚本如下

#!/usr/bin/env python3  
# -*- coding: utf-8 -*-  
"""  
 @desc:  
 @author: 
 """
from appium import webdriver
desired_caps = {
                'platformName': 'Android',
                'deviceName': '04157df4704cd01b',
                'platformVersion': '6.0.1',
                'noReset':'true',
                'appPackage': 'com.android.chrome',
                'appActivity': 'com.google.android.apps.chrome.Main'
                }

dr=webdriver.Remote('http://127.0.0.1:4723/wd/hub', desired_caps)
dr.get('https://www.baidu.com')

小弟卡这里很久了,找不出原因为什么,求大佬指点一下方向

最佳回复

去掉 appPackage、appActivity 参数,加 browserName : Chrome 试试

共收到 2 条回复 时间 点赞

去掉 appPackage、appActivity 参数,加 browserName : Chrome 试试

@xiaoMGitHub 谢谢大佬 还真是这样

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册