javav语言启动Appium v1.12.0启动错误记录

发布时间:2020-06-18 00:33:14 作者:知止内明
来源:网络 阅读:650

启动类

  public static AndroidDriver<AndroidElement> driver;

    /**
     * >aapt d badging GJDMALL-V2.2.0.3349-436-debug-99a5c6a.apk|findstr "package launchable-activity"
     * package: name='com.jingdong.th.app' versionCode='3346' versionName='2.2.0' platformBuildVersionName='8.0.0'
     * launchable-activity: name='com.jingdong.global.app.welcome.WelcomeActivity'  label='' icon=''
     * 初始化
     * @return
     * @throws Exception
     */
    public static AndroidDriver<AndroidElement> initDriver() throws Exception {

        File app = new File(".\\apk\\GJDMALL-V2.2.0.3349-436-debug-99a5c6a.apk");
        DesiredCapabilities caps = new DesiredCapabilities();
        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "android");
        caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "android");
        caps.setCapability(MobileCapabilityType.APPIUM_VERSION, "4.4.2");
        //caps.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());  //自动安装
        caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "127.0.0.1:62001");
        caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 600);
        //caps.setCapability(MobileCapabilityType.FULL_RESET, true); //结束后会卸载程序
        caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.jingdong.th.app");
        caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.jingdong.global.app.welcome.WelcomeActivity");
        caps.setCapability(AndroidMobileCapabilityType.UNICODE_KEYBOARD, true);
        caps.setCapability(AndroidMobileCapabilityType.RESET_KEYBOARD, true);
        caps.setCapability(AndroidMobileCapabilityType.NO_SIGN, true);
        driver = new AndroidDriver<>(
                new URL("http://127.0.0.1:4723/wd/hub"), caps);
        return driver;
    }

出现错误


HTTP] --> POST /wd/hub/session
[HTTP] {"desiredCapabilities":{"appActivity":"com.jingdong.global.app.welcome.WelcomeActivity","appPackage":"com.jingdong.th.app","newCommandTimeout":600,"noSign":true,"appiumVersion":"4.4.2","automationName":"Appium","unicodeKeyboard":true,"platformName":"Android","udid":"127.0.0.1:62001","resetKeyboard":true},"capabilities":{"firstMatch":[{"appium:appActivity":"com.jingdong.global.app.welcome.WelcomeActivity","appium:appPackage":"com.jingdong.th.app","appium:appiumVersion":"4.4.2","appium:automationName":"Appium","appium:newCommandTimeout":600,"appium:noSign":true,"platformName":"android","appium:resetKeyboard":true,"appium:udid":"127.0.0.1:62001","appium:unicodeKeyboard":true}]}}
[debug] [W3C] Calling AppiumDriver.createSession() with args: [{"appActivity":"com.jingdong.global.app.welcome.WelcomeActivity","appPackage":"com.jingdong.th.app","newCommandTimeout":600,"noSign":true,"appiumVersion":"4.4.2","automationName":"Appium","unicodeKeyboard":true,"platformName":"Android","udid":"127.0.0.1:62001","resetKeyboard":true},null,{"firstMatch":[{"appium:appActivity":"com.jingdong.global.app.welcome.WelcomeActivity","appium:appPackage":"com.jingdong.th.app","appium:appiumVersion":"4.4.2","appium:automationName":"Appium","appium:newCommandTimeout":600,"appium:noSign":true,"platformName":"android","appium:resetKeyboard":true,"appium:udid":"127.0.0.1:62001","appium:unicodeKeyboard":true}]}]
[debug] [BaseDriver] Event 'newSessionRequested' logged at 1561284179583 (18:02:59 GMT+0800 (中国标准时间))
[Appium] Could not parse W3C capabilities: 'deviceName' can't be blank
[Appium] Trying to fix W3C capabilities by merging them with JSONWP caps
[BaseDriver] The capabilities ["appActivity","appPackage","appiumVersion","automationName","newCommandTimeout","noSign","resetKeyboard","udid","unicodeKeyboard"] are not standard capabilities and should have an extension prefix
*[Appium] Could not parse fixed W3C capabilities: 'deviceName' can't be blank. Falling back to JSONWP protocol*
[debug] [BaseDriver] Event 'newSessionStarted' logged at 1561284179596 (18:02:59 GMT+0800 (中国标准时间))
[debug] [MJSONWP] Encountered internal error running command: Error: Could not find a driver for automationName 'Appium' and platformName 'Android'. Please check your desired capabilities.
[debug] [MJSONWP]     at AppiumDriver.getDriverAndVersionForCaps (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\lib\appium.js:205:11)
[debug] [MJSONWP]     at AppiumDriver.getDriverAndVersionForCaps [as createSession] (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\lib\appium.js:268:66)
[debug] [MJSONWP]     at AppiumDriver.executeCommand (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_appium-base-driver@3.15.4@appium-base-driver\lib\basedriver\driver.js:301:19)
[debug] [MJSONWP]     at AppiumDriver.executeCommand (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\lib\appium.js:420:26)
[debug] [MJSONWP]     at executeCommand (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_appium-base-driver@3.15.4@appium-base-driver\lib\protocol\protocol.js:352:34)
[debug] [MJSONWP]     at asyncHandler (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_appium-base-driver@3.15.4@appium-base-driver\lib\protocol\protocol.js:489:15)
[debug] [MJSONWP]     at Layer.handle [as handle_request] (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at next (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\route.js:137:13)
[debug] [MJSONWP]     at Route.dispatch (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\route.js:112:3)
[debug] [MJSONWP]     at Layer.handle [as handle_request] (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\index.js:281:22
[debug] [MJSONWP]     at Function.process_params (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\index.js:335:12)
[debug] [MJSONWP]     at next (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\index.js:275:10)
[debug] [MJSONWP]     at logger (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_morgan@1.9.1@morgan\index.js:144:5)
[debug] [MJSONWP]     at Layer.handle [as handle_request] (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at trim_prefix (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\index.js:317:13)
[debug] [MJSONWP]     at C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\index.js:284:7
[debug] [MJSONWP]     at Function.process_params (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\index.js:335:12)
[debug] [MJSONWP]     at next (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_express@4.16.4@express\lib\router\index.js:275:10)
[debug] [MJSONWP]     at C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_body-parser@1.18.3@body-parser\lib\read.js:130:5
[debug] [MJSONWP]     at invokeCallback (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_raw-body@2.3.3@raw-body\index.js:224:16)
[debug] [MJSONWP]     at done (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_raw-body@2.3.3@raw-body\index.js:213:7)
[debug] [MJSONWP]     at IncomingMessage.onEnd (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\_raw-body@2.3.3@raw-body\index.js:273:7)
[debug] [MJSONWP]     at emitNone (events.js:106:13)
[debug] [MJSONWP]     at IncomingMessage.emit (events.js:208:7)
[debug] [MJSONWP]     at endReadableNT (_stream_readable.js:1055:12)
[debug] [MJSONWP]     at _combinedTickCallback (internal/process/next_tick.js:138:11)
[debug] [MJSONWP]     at process._tickCallback (internal/process/next_tick.js:180:9)

javav语言启动Appium v1.12.0启动错误记录

解决

  public static AndroidDriver<AndroidElement> initDriver() throws Exception {

        File app = new File(".\\apk\\GJDMALL-V2.2.0.3349-436-debug-99a5c6a.apk");
        DesiredCapabilities caps = new DesiredCapabilities();
//        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "android");
//        caps.setCapability(MobileCapabilityType.PLATFORM_NAME, "android");
        caps.setCapability(MobileCapabilityType.APPIUM_VERSION, "4.4.2");
        //caps.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());  //自动安装
//        caps.setCapability(MobileCapabilityType.AUTOMATION_NAME, "Appium");
        caps.setCapability(MobileCapabilityType.DEVICE_NAME, "127.0.0.1:62001");
        caps.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 600);
        //caps.setCapability(MobileCapabilityType.FULL_RESET, true); //结束后会卸载程序
        caps.setCapability(AndroidMobileCapabilityType.APP_PACKAGE, "com.jingdong.th.app");
        caps.setCapability(AndroidMobileCapabilityType.APP_ACTIVITY, "com.jingdong.global.app.welcome.WelcomeActivity");
        caps.setCapability(AndroidMobileCapabilityType.UNICODE_KEYBOARD, true);
        caps.setCapability(AndroidMobileCapabilityType.RESET_KEYBOARD, true);
        caps.setCapability(AndroidMobileCapabilityType.NO_SIGN, true);
        driver = new AndroidDriver<>(
                new URL("http://127.0.0.1:4723/wd/hub"), caps);
        return driver;
    }

正常启动appium
javav语言启动Appium v1.12.0启动错误记录

推荐阅读:
  1. Appium Server 和 Appium Desktop
  2. mac下appium启动

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

javav语言启动appium v1.1 pp ava

上一篇:canvas绘制五角形

下一篇:vbs IP 验证 正则表达式

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》