51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 3176|回复: 2
打印 上一主题 下一主题

[Appium] 使用appium测试Android app遇到无法启动app的问题

[复制链接]
  • TA的每日心情
    开心
    2016-2-24 08:32
  • 签到天数: 27 天

    连续签到: 1 天

    [LV.4]测试营长

    跳转到指定楼层
    1#
    发表于 2017-6-16 09:44:12 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    各位大神,我在使用appium进行安卓app自动化测试的时候,遇到一个问题,
    就是只有在手机重启之后的10~15分钟之内,app可以正常运行,
    而超过这个时间,我无法再启动app,即使等很久,看起来好像是在手机端的appium.uiautomator2.server暂停运行了,所以没有相应?
    这个时候,我只有重启手机,才能恢复正常,但是同样,超过10~15分钟,又无法连接了,各位大神有遇到这种情况,或者给点帮助的么?

    无法连接的时候,ADB log 如下:

    [UiAutomator2] Starting uiautomator2 server v0.1.5 with cmd: am,instrument,-w,io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner
    [UiAutomator2] running command...
    adb -s 33c535c8 shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner...
    [UiAutomator2] Waiting up to 20000ms for UiAutomator2 to be online...
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [JSONWP Proxy] Proxying [GET /status] to [GET http://localhost:8200/wd/hub/status] with no body
    [debug] [UiAutomator2] Deleting UiAutomator2 session
    [debug] [UiAutomator2] Deleting UiAutomator2 server session
    [UiAutomator2] Did not get confirmation UiAutomator2 deleteSession worked; Error was: Error: Trying to proxy a session command without session id
    [debug] [ADB] Getting connected devices...
    [debug] [ADB] 1 device(s) connected
    [debug] [ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","33c535c8","shell","am","force-stop","com.dashang.tiangou"]
    [debug] [Logcat] Stopping logcat capture
    [debug] [ADB] Removing forwarded port socket connection: 8200
    [debug] [ADB] Running 'C:\Program Files (x86)\Android\android-sdk\platform-tools\adb.exe' with args: ["-P",5037,"-s","33c535c8","forward","--remove","tcp:8200"]
    [MJSONWP] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: Error: read ECONNRESET
        at JWProxy.proxy$ (../../../lib/jsonwp-proxy/proxy.js:153:13)
        at tryCatch (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:67:40)
        at GeneratorFunctionPrototype.invoke [as _invoke] (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:315:22)
        at GeneratorFunctionPrototype.prototype.(anonymous function) [as throw] (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:100:21)
        at GeneratorFunctionPrototype.invoke (C:\Program Files\nodejs\node_modules\appium\node_modules\babel-runtime\regenerator\runtime.js:136:37)



    我的系统环境如下:

    Appium Version : 1.6.5
    Java-Client: 5.0.0-BETA5
    Selenium-java:3.4.0
    JDK: jdk1.8.0_112
    Android: 6.0.1

    代码配置如下:

           DesiredCapabilities capabilities = new DesiredCapabilities();

            capabilities.setCapability("deviceName", appDeviceName);
            capabilities.setCapability("platformVersion", appPlatFormVersion);
            capabilities.setCapability("app", apk.getAbsolutePath());
            capabilities.setCapability("appActivity", activityName);
            capabilities.setCapability("platformName", "android");
            capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME, AutomationName.ANDROID_UIAUTOMATOR2);
            capabilities.setCapability(AndroidMobileCapabilityType.APP_WAIT_ACTIVITY, "com.dashang.*");
            capabilities.setCapability("autoGrantPermissions", "true");

            driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities);
    分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
    收藏收藏
    回复

    使用道具 举报

    该用户从未签到

    3#
    发表于 2017-10-4 17:15:06 | 只看该作者
    我也遇到了这个问题,请问楼主解决了没呀
    回复 支持 反对

    使用道具 举报

    本版积分规则

    关闭

    站长推荐上一条 /1 下一条

    小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

    GMT+8, 2024-11-23 03:56 , Processed in 0.066160 second(s), 22 queries .

    Powered by Discuz! X3.2

    © 2001-2024 Comsenz Inc.

    快速回复 返回顶部 返回列表