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

启动类

  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\[email protected]@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\[email protected]@appium-base-driver\lib\protocol\protocol.js:352:34)
[debug] [MJSONWP]     at asyncHandler (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@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\[email protected]@express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at next (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\route.js:137:13)
[debug] [MJSONWP]     at Route.dispatch (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@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\[email protected]@express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\index.js:281:22
[debug] [MJSONWP]     at Function.process_params (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\index.js:335:12)
[debug] [MJSONWP]     at next (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\index.js:275:10)
[debug] [MJSONWP]     at logger (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@morgan\index.js:144:5)
[debug] [MJSONWP]     at Layer.handle [as handle_request] (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\layer.js:95:5)
[debug] [MJSONWP]     at trim_prefix (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\index.js:317:13)
[debug] [MJSONWP]     at C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\index.js:284:7
[debug] [MJSONWP]     at Function.process_params (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\index.js:335:12)
[debug] [MJSONWP]     at next (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@express\lib\router\index.js:275:10)
[debug] [MJSONWP]     at C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@body-parser\lib\read.js:130:5
[debug] [MJSONWP]     at invokeCallback (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@raw-body\index.js:224:16)
[debug] [MJSONWP]     at done (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@raw-body\index.js:213:7)
[debug] [MJSONWP]     at IncomingMessage.onEnd (C:\Users\liwen406\AppData\Roaming\npm\node_modules\appium\node_modules\[email protected]@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)

解决

  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

原文地址:https://blog.51cto.com/357712148/2412473

时间: 2024-11-01 16:30:35

javav语言启动Appium v1.12.0启动错误记录的相关文章

kubeadm创建高可用kubernetes v1.12.0集群

节点规划 主机名 IP Role k8s-master01 10.3.1.20 etcd.Master.Node.keepalived k8s-master02 10.3.1.21 etcd.Master.Node.keepalived k8s-master03 10.3.1.25 etcd.Master.Node.keepalived VIP 10.3.1.29 None 版本信息: OS::Ubuntu 16.04 Docker:17.03.2-ce k8s:v1.12 来自官网的高可用架构

kubernetes之Kubeadm快速安装v1.12.0版

通过Kubeadm只需几条命令即起一个单机版kubernetes集群系统,而后快速上手k8s.在kubeadm中,需手动安装Docker和kubeket服务,Docker运行容器引擎,kubelet是启动Pod的核心组件,每一个节点都安装好kubelet和Docker,那么运行容器和Pod的环境就准备好了,在此基础之上,使用Kubeadm工具自动配置kubelet并启动kubelet服务,将Master所有组件和Node上剩余的kube-proxy组件都运行为Pod,托管在k8s之上. 服务器规

k8s升级,此次升级是1.12.0–&gt;1.13.0

准备 1.首先升级master节点的基础组件kubeadm.kubelet.kubectl apt-get update && apt-get upgrade kubeadm 更新到1.13.0后,在master执行,执行一次 kubeadm upgrade plan [upgrade/versions] Latest version in the v1.12 series: v1.13.0 External components that should be upgraded manua

Linux内核源码分析--内核启动之(3)Image内核启动(C语言部分)(Linux-3.0 ARMv7) 【转】

原文地址:Linux内核源码分析--内核启动之(3)Image内核启动(C语言部分)(Linux-3.0 ARMv7) 作者:tekkamanninja 转自:http://blog.chinaunix.net/uid-25909619-id-4938390.html 在构架相关的汇编代码运行完之后,程序跳入了构架无关的内核C语言代码:init/main.c中的start_kernel函数,在这个函数中Linux内核开始真正进入初始化阶段, 下面我就顺这代码逐个函数的解释,但是这里并不会过于深入

Appium 1.9.1 启动报错 Fatal TypeError: Class constructor BaseDriver cannot be invoked without &#39;new&#39;

安装了appium 1.9.1后一直报错Fatal TypeError: Class constructor BaseDriver cannot be invoked without 'new',无法启动,卸载后安装1.8.1可以正常使用了. npm install -g cnpm --registry=https://registry.npm.taobao.org cnpm uninstall -g appium cnpm install -g [email protected]1.8.1 r

【Java 语言】Java 多线程 一 ( 线程启动 | 线程中断 )

一. 线程启动 线程启动 : -- 1. 继承 Thread 运行线程 : 重写 Thread 类的 run 方法, 然后执行该线程; -- 2. 实现 Runnable 接口, 并运行线程; -- 代码示例 : package com.hanshuliang.thread; public class ThreadStart { public static void main(String[] args) { //1. 继承 Thread 运行线程 MyThread thread = new M

appium简明教程(6)——启动appium及android模拟器

一般情况下,我们都从命令行启动appium. windows下,dos命令窗口输入 appium 如果该命令报错,那么请重装appium npm install -g appium 如果安装出错,请自行更换npm源. npm -g --registry http://registry.cnpmjs.org install appium 然后请打开android的模拟器,如果没有请新建一个虚拟设备 下面的代码以启动android原生的计算器程序为例 ruby篇 require 'appium_li

关于web.xml3.0启动报错

九月 08, 2017 10:18:19 上午 org.apache.tomcat.util.digester.SetPropertiesRule begin 警告: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:war_item' did not find a matching property. 九月 08, 20

Java代码启动Appium server

前言 Appium的启动方式有下面的两种: 使用Appium GUI启动,这种方式需要下载一个appium的客户端,然后填写地址和端口号.这是最简单粗暴的. 使用代码appium自带的库函数来实现启动appium server的启动 这篇文章着重讲使用代码实现appium server的启动 使用AppiumDriverLocalService 使用这个方法得先做下面的工作 在本机安装Node/js 使用npm安装Appium server 使用java代码启动Appium server主要依靠