简体   繁体   English

在Android第三方设备上运行appium必须使用哪些文件?

[英]Which files are mandatory to run appium on an Android 3rd party device?

I use appium for the first time. 我第一次使用appium。 I want to run a simple automation on a 3rd party installed app. 我想在第三方安装的应用程序上运行简单的自动化。 I want to configure the appium server for that specific app. 我想为该特定应用配置appium服务器。

I have few questions: 我有几个问题:

  1. Which fields are mandatory? 哪些字段是强制性的?

  2. I have to fill them manually? 我必须手动填写它们吗? because my Android is plugged in to the mac, and yet I cannot autocomplete names. 因为我的Android插入了Mac,但我无法自动完成名称。

  3. How can I easily find the desired app apk path and it's launch activity (I guess after double clicking the apk?) 我怎样才能轻松找到所需的应用程序apk路径和它的启动活动(我猜双击apk后?)

在此输入图像描述

Update: 更新:

I now get the following error: 我现在收到以下错误:

doesn't work. 不起作用。

new console opened: 新控制台开启:

➜  ~  echo $JAVA_HOME
/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home

Doctor: 医生:

Running Android Checks 运行Android检查

✔ ANDROID_HOME is set to "/Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/"
✔ JAVA_HOME is set to "/Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home."
✔ ADB exists at /Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/platform-tools/adb
✔ Android exists at /Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/tools/android
✔ Emulator exists at /Users/eladb/MyWorkspace2/adt-bundle-mac-x86_64/sdk/tools/emulator
✔ Android Checks were successful.

✔ All Checks were successful
➜  ~

and yet appium says: 然而appium说:

info: [debug] Responding to client with success: {"status":0,"value":{"build":{"version":"1.3.5","revision":"a124a15677e26b33db16e81c4b3b34d9c6b8cac9"}}}
info: <-- GET /wd/hub/status 200 0.927 ms - 104 {"status":0,"value":{"build":{"version":"1.3.5","revision":"a124a15677e26b33db16e81c4b3b34d9c6b8cac9"}}}

info: --> POST /wd/hub/session {"desiredCapabilities":{"appPackage":"com.grindrapp.android","appActivity":".activity.SplashActivity","platformVersion":"4.4.2","browserName":"","platformName":"Android","deviceName":"10.0.0.9:5555"}}

info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)

info: [debug] Didn't get app but did get Android package, will attempt to launch it on the device

info: [debug] Creating new appium session e232fa9d-a70c-4de9-84e7-d86441cc9dc6

info: Starting android appium

info: [debug] Getting Java version

info: [debug] Cleaning up android objects

info: [debug] Cleaning up appium session

info: [debug] Error: Could not get the Java version. Is Java installed?
    at /Applications/Appium.app/Contents/Resources/node_modules/appium/lib/devices/android/android-common.js:1040:17
    at ChildProcess.exithandler (child_process.js:735:7)
    at ChildProcess.emit (events.js:110:17)
    at maybeClose (child_process.js:1008:16)
    at Socket.<anonymous> (child_process.js:1176:11)
    at Socket.emit (events.js:107:17)
    at Pipe.close (net.js:476:12)

error: Failed to start an Appium session, err was: Error: Could not get the Java version. Is Java installed?

info: [debug] Responding to client with error: {"status":33,"value":{"message":"A new session could not be created. (Original error: Could not get the Java version. Is Java installed?)","origValue":"Could not get the Java version. Is Java installed?"},"sessionId":null}
info: <-- POST /wd/hub/session 500 87.838 ms - 222 

info: --> GET /wd/hub/status {}

I'm using appium 1.3.5 我正在使用appium 1.3.5

You need to mention the following fields: 您需要提及以下字段:

  1. App path 应用路径
  2. package name 包裹名字
  3. launch activity(you can ask your developers to find the launch activity of the apk file) 启动活动(您可以要求您的开发人员找到apk文件的启动活动)
  4. device 设备
  5. SDK path SDK路径
  6. Bootstrap port Bootstrap端口
  7. Server Address(by default 127.0.0.1) 服务器地址(默认为127.0.0.1)
  8. Port(by default it runs on 4723) 端口(默认情况下,它在4723上运行)

If you don't want to mention these in the Appium, you can also mention it in your scripts by using capabilities class. 如果您不想在Appium中提及这些内容,您还可以使用功能类在脚本中提及它。

DesiredCapabilities capabilities = new DesiredCapabilities();
            capabilities.setCapability("platformName", "Android");
            capabilities.setCapability("deviceName", "Android");
            capabilities.setCapability("platformVersion", "4.4.2");
            capabilities.setCapability("appPackage", "something");
            capabilities.setCapability("appActivity", "something");
            capabilities.setCapability("udid", udid);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM