appium 环境搭建 java

1 安装node.js

1.1 安装node.js

http://nodejs.cn/download/

1.2、下载后直接点击exe,按照提示一步一步的安装

1.3 安装成功后,运行cmd,输入node –v,如果安装成功,会输出如下版本信息

 

2 eclipse android开发环境搭建

2.1 用eclipse开发,需要下载jdk、eclipse、adt(android development tools 安卓开发工具包)、sdk(software development kit 软件开发工具包),如果不用真机而用模拟器则还需要下载avd(android virtual device 安卓虚拟设备)。为了方便我直接下载的是adt-bundle-windows。

目录如下:

 

2.2 设置环境变量

ANDROID_HOME = D:\software\sdk
ANDROID_SDK_HOME =  D:\software\sdk
PATH = %ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;

 

在eclipse选择sdk,windows->preferences

 

2.3 查看连接设备。手机启动开发者模式,用USB连接电脑,运行cmd,到sdk的platform-tools,输入adb devices,如果看到设备号即成功。

 

3 安装appium

3.1、下载文件

 https://bitbucket.org/appium/appium.app/downloads/

 

 

3.2 安装,点击exe,一步一步按照提示操作,直至完成。过程中会提示让你安装.net framework,可以安装完appium再安装它,这一点还是蛮好的,软件百度一下就有了。

3.3 设置环境变量,在path添加:

D:\software\Appium_windows\Appium\node_modules\.bin;

3.4 运行cmd,输入appium-doctor,出现"All Checks were successful"即安装成功。

 

4 联机测试

4.1 手机连接电脑。手机启动开发者模式,用USB连接电脑,运行cmd,到sdk的platform-tools,输入adb devices。

 

4.2  启动appium。

双击appium快捷键。

 

 点击launch

 

4.3 启动应用。启动应用有两种方式

一 通过appium。

1)从应用市场下载"快钱钱包"到本地,双击appium快捷键,点击小安卓机器人android settings选择应用。

 

tips:手机型号查看。比如华为手机,设置->关于手机->型号。其他手机类似。

 

2)general settings

 

3)点击launch

手机应用会自动打开

     

 

appium日志:

 

> Launching Appium server with command: D:\software\Appium_windows\Appium\node.exe lib\server\main.js --address 127.0.0.1 --port 4723 --app D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk --app-activity com.bill99.kuaiqian.ui.base.WelcomeActivity --app-pkg com.bill99.kuaiqian --pre-launch --session-override --platform-name Android --platform-version 23 --automation-name Appium --device-name "HUAWEI GRA-UL00" --log-no-color
> info: [debug] Starting Appium in pre-launch mode
> info: Pre-launching app
> info: [debug] Using local app from command line: D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk
> info: [debug] Creating new appium session cea2d326-6a15-43e9-9482-36cf2e89a73a
> info: Starting android appium
> info: [debug] Getting Java version
> info: Java version is: 1.7.0_72
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\software\sdk\platform-tools\adb.exe
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Checking whether app is actually present
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device T7G5T15427004998
> info: [debug] Setting device id to T7G5T15427004998
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 wait-for-device
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 21
> info: Device API level is: 21
> info: [debug] Extracting strings for language: default
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop persist.sys.language"
> info: [debug] Current device persist.sys.language: zh
> info: [debug] java -jar "D:\software\Appium_windows\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk" "C:\Users\xiangnan.qi\AppData\Local\Temp\com.bill99.kuaiqian" zh
> info: [debug] Reading strings from converted strings.json
> info: [debug] Setting language to default
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 push "C:\\Users\\xiangnan.qi\\AppData\\Local\\Temp\\com.bill99.kuaiqian\\strings.json" /data/local/tmp
> info: [debug] Checking whether aapt is present
> info: [debug] Using aapt from D:\software\sdk\build-tools\android-4.3\aapt.exe
> info: [debug] Retrieving process from manifest.
> info: [debug] executing cmd: D:\software\sdk\build-tools\android-4.3\aapt.exe dump xmltree D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk AndroidManifest.xml
> info: [debug] Set app process to: com.bill99.kuaiqian
> info: [debug] Not uninstalling app since server not started with --full-reset
> info: [debug] Checking app cert for D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk.
> info: [debug] executing cmd: java -jar D:\software\Appium_windows\Appium\node_modules\appium\node_modules\appium-adb\jars\verify.jar D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk
> info: [debug] App already signed.
> info: [debug] Zip-aligning D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk
> info: [debug] Checking whether zipalign is present
> info: [debug] Using zipalign from D:\software\sdk\tools\zipalign.exe
> info: [debug] Zip-aligning apk.
> info: [debug] executing cmd: D:\software\sdk\tools\zipalign.exe -f 4 D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk C:\Users\xiangnan.qi\AppData\Local\Temp\11703-7352-r0a80d\appium.tmp
> info: [debug] MD5 for app is 072b08f27c14683756eafc3418ed3971
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "ls /data/local/tmp/072b08f27c14683756eafc3418ed3971.apk"
> info: [debug] Getting install status for com.bill99.kuaiqian
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 21
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "pm list packages -3 com.bill99.kuaiqian"
> info: [debug] App is installed
> info: App is already installed, resetting app
> info: [debug] Running fast reset (stop and clear)
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "am force-stop com.bill99.kuaiqian"
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "pm clear com.bill99.kuaiqian"
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 push "D:\\software\\Appium_windows\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: [debug] Pushing settings apk to device...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 install "D:\software\Appium_windows\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 install "D:\software\Appium_windows\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.bill99.kuaiqian -e disableAndroidWatchers false
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
> info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
> info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
> info: [debug] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] json loading complete.
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] Waking up device if it's not alive
> info: [debug] Pushing command to appium work queue: ["wake",{}]
> info: [debug] [BOOTSTRAP] [debug] Client connected
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: wake
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "dumpsys window"
> info: [debug] Screen already unlocked, continuing.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
> info: [debug] dataDir set to: /data/local/tmp
> info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 21
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.bill99.kuaiqian/com.bill99.kuaiqian.ui.base.WelcomeActivity"
> info: [debug] Waiting for pkg "com.bill99.kuaiqian" and activity "com.bill99.kuaiqian.ui.base.WelcomeActivity" to be focused
> info: [debug] Getting focused package and activity
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "dumpsys window windows"
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.release"
> info: [debug] Device is at release version 5.0.1
> info: [debug] Device launched! Ready for commands
> info: [debug] Setting command timeout to the default of 60 secs
> info: Welcome to Appium v1.4.16 (REV ae6877eff263066b26328d457bd285c0cc62430d)
> info: Appium REST http interface listener started on 127.0.0.1:4723
> info: [debug] Non-default server args: {"app":"D:\\software\\adt-bundle-windows\\sdk\\platform-tools\\app_installed\\kuaiqianqianbaoapp.apk","address":"127.0.0.1","sessionOverride":true,"launch":true,"logNoColors":true,"androidPackage":"com.bill99.kuaiqian","androidActivity":"com.bill99.kuaiqian.ui.base.WelcomeActivity","deviceName":"HUAWEI GRA-UL00","platformName":"Android","platformVersion":"23","automationName":"Appium"}
> info: Console LogLevel: debug

 

应用默认打开60秒自动退出

 

注意:

应用如果打不开则需要检查电脑的安装包是否损坏。将app安装到手机上看看能否打开。

 

二 通过脚本。

1)打开appium。点击luanch

 

注意:

之前的android settings和general settings的选项都关闭掉。

 

 

2)在eclipse新建junit(实现打开应用,从应用首页到理财界面),然后运行。

参考代码只需要更改:app/deviceName/appPackage/appActivity。分别是app路径/设备名称/应用package/应用activity

package com.glen.demo;import io.appium.java_client.AppiumDriver;import java.io.File;
import java.net.URL;import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.DesiredCapabilities;public class KQQBTest {private AppiumDriver driver;@Beforepublic void setUp() throws Exception {File app = new File("D:\\software\\adt-bundle-windows\\sdk\\platform-tools\\app_installed","kuaiqianqianbaoapp.apk");// 设置自动化相关参数DesiredCapabilities capabilities = new DesiredCapabilities();capabilities.setCapability("platformName", "Android");
      capabilities.setCapability(
"deviceName", "HUAWEI GRA-UL00");// 设置apk路径capabilities.setCapability("app", app.getAbsolutePath());capabilities.setCapability("noSign", true);// 设置app的主包名和主类名capabilities.setCapability("appPackage","com.bill99.kuaiqian");capabilities.setCapability("appActivity", "com.bill99.kuaiqian.ui.base.WelcomeActivity");// 初始化driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);Thread.sleep(15*1000);}@Testpublic void test() {WebElement licai = driver.findElementById("com.bill99.kuaiqian:id/q9");System.out.println("控件文本"+licai.getText());licai.click();}@Afterpublic void tearDown() throws Exception {driver.quit();} }

 

控制台日志:

手机理财截图:

 

appium日志:

> info: --> POST /wd/hub/session {"desiredCapabilities":{"app":"D:\\software\\adt-bundle-windows\\sdk\\platform-tools\\app_installed\\kuaiqianqianbaoapp.apk","deviceName":"HUAWEI GRA-UL00","platformName":"Android","appActivity":"com.bill99.kuaiqian.ui.base.WelcomeActivity","noSign":true,"appPackage":"com.bill99.kuaiqian"}}
> info: Client User-Agent string: Apache-HttpClient/4.3.4 (java 1.5)
> info: [debug] Using local app from desired caps: D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk
> info: [debug] Creating new appium session 80a6ad1b-ed9d-4b75-be4e-31996205002f
> info: Starting android appium
> info: [debug] Getting Java version
> info: Java version is: 1.7.0_72
> info: [debug] Checking whether adb is present
> info: [debug] Using adb from D:\software\sdk\platform-tools\adb.exe
> info: [debug] Using fast reset? true
> info: [debug] Preparing device for session
> info: [debug] Checking whether app is actually present
> info: Retrieving device
> info: [debug] Trying to find a connected android device
> info: [debug] Getting connected devices...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe devices
> info: [debug] 1 device(s) connected
> info: Found device T7G5T15427004998
> info: [debug] Setting device id to T7G5T15427004998
> info: [debug] Waiting for device to be ready and to respond to shell commands (timeout = 5)
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 wait-for-device
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "echo 'ready'"
> info: [debug] Starting logcat capture
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 21
> info: Device API level is: 21
> info: [debug] Extracting strings for language: default
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop persist.sys.language"
> info: [debug] Current device persist.sys.language: zh
> info: [debug] java -jar "D:\software\Appium_windows\Appium\node_modules\appium\node_modules\appium-adb\jars\appium_apk_tools.jar" "stringsFromApk" "D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk" "C:\Users\xiangnan.qi\AppData\Local\Temp\com.bill99.kuaiqian" zh
> info: [debug] Reading strings from converted strings.json
> info: [debug] Setting language to default
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 push "C:\\Users\\xiangnan.qi\\AppData\\Local\\Temp\\com.bill99.kuaiqian\\strings.json" /data/local/tmp
> info: [debug] Checking whether aapt is present
> info: [debug] Using aapt from D:\software\sdk\build-tools\android-4.3\aapt.exe
> info: [debug] Retrieving process from manifest.
> info: [debug] executing cmd: D:\software\sdk\build-tools\android-4.3\aapt.exe dump xmltree D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk AndroidManifest.xml
> info: [debug] Set app process to: com.bill99.kuaiqian
> info: [debug] Not uninstalling app since server not started with --full-reset
> info: [debug] noSign capability set to true, skipping checking and signing of app
> info: [debug] MD5 for app is 072b08f27c14683756eafc3418ed3971
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "ls /data/local/tmp/072b08f27c14683756eafc3418ed3971.apk"
> info: [debug] Getting install status for com.bill99.kuaiqian
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.sdk"
> info: [debug] Device is at API Level 21
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "pm list packages -3 com.bill99.kuaiqian"
> info: [debug] App is installed
> info: App is already installed, resetting app
> info: [debug] Running fast reset (stop and clear)
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "am force-stop com.bill99.kuaiqian"
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "pm clear com.bill99.kuaiqian"
> info: [debug] Forwarding system:4724 to device:4724
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 forward tcp:4724 tcp:4724
> info: [debug] Pushing appium bootstrap to device...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 push "D:\\software\\Appium_windows\\Appium\\node_modules\\appium\\build\\android_bootstrap\\AppiumBootstrap.jar" /data/local/tmp/
> info: [debug] Pushing settings apk to device...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 install "D:\software\Appium_windows\Appium\node_modules\appium\build\settings_apk\settings_apk-debug.apk"
> info: [debug] Pushing unlock helper app to device...
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 install "D:\software\Appium_windows\Appium\node_modules\appium\build\unlock_apk\unlock_apk-debug.apk"
> info: Starting App
> info: [debug] Attempting to kill all 'uiautomator' processes
> info: [debug] Getting all processes with 'uiautomator'
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "ps 'uiautomator'"
> info: [debug] No matching processes found
> info: [debug] Running bootstrap
> info: [debug] spawning: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell uiautomator runtest AppiumBootstrap.jar -c io.appium.android.bootstrap.Bootstrap -e pkg com.bill99.kuaiqian -e disableAndroidWatchers false
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] io.appium.android.bootstrap.Bootstrap:
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 1
> info: [debug] [BOOTSTRAP] [debug] Socket opened on port 4724
> info: [debug] [BOOTSTRAP] [debug] Appium Socket Server Ready
> info: [debug] [BOOTSTRAP] [debug] Loading json...
> info: [debug] [BOOTSTRAP] [debug] json loading complete.
> info: [debug] Waking up device if it's not alive
> info: [debug] Pushing command to appium work queue: ["wake",{}]
> info: [debug] [BOOTSTRAP] [debug] Registered crash watchers.
> info: [debug] [BOOTSTRAP] [debug] Client connected
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "dumpsys window"
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"wake","params":{}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: wake
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
> info: [debug] Screen already unlocked, continuing.
> info: [debug] Pushing command to appium work queue: ["getDataDir",{}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"getDataDir","params":{}}
> info: [debug] dataDir set to: /data/local/tmp
> info: [debug] Pushing command to appium work queue: ["compressedLayoutHierarchy",{"compressLayout":false}]
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getDataDir
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"\/data\/local\/tmp"}
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"compressedLayoutHierarchy","params":{"compressLayout":false}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: compressedLayoutHierarchy
> info: [debug] Getting device API level
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.sdk"
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":false}
> info: [debug] Device is at API Level 21
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "am start -S -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -f 0x10200000 -n com.bill99.kuaiqian/com.bill99.kuaiqian.ui.base.WelcomeActivity"
> info: [debug] Waiting for pkg "com.bill99.kuaiqian" and activity "com.bill99.kuaiqian.ui.base.WelcomeActivity" to be focused
> info: [debug] Getting focused package and activity
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "dumpsys window windows"
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "getprop ro.build.version.release"
> info: [debug] Device is at release version 5.0.1
> info: [debug] Device launched! Ready for commands
> info: [debug] Setting command timeout to the default of 60 secs
> info: [debug] Appium session started with sessionId 80a6ad1b-ed9d-4b75-be4e-31996205002f
> info: <-- POST /wd/hub/session 303 15604.592 ms - 74 
> info: --> GET /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f {}
> info: [debug] Responding to client with success: {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"5.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"D:\\software\\adt-bundle-windows\\sdk\\platform-tools\\app_installed\\kuaiqianqianbaoapp.apk","deviceName":"HUAWEI GRA-UL00","platformName":"Android","appActivity":"com.bill99.kuaiqian.ui.base.WelcomeActivity","noSign":true,"appPackage":"com.bill99.kuaiqian"},"app":"D:\\software\\adt-bundle-windows\\sdk\\platform-tools\\app_installed\\kuaiqianqianbaoapp.apk","deviceName":"T7G5T15427004998","platformName":"Android","appActivity":"com.bill99.kuaiqian.ui.base.WelcomeActivity","noSign":true,"appPackage":"com.bill99.kuaiqian"},"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: <-- GET /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f 200 2.362 ms - 862 {"status":0,"value":{"platform":"LINUX","browserName":"Android","platformVersion":"5.0.1","webStorageEnabled":false,"takesScreenshot":true,"javascriptEnabled":true,"databaseEnabled":false,"networkConnectionEnabled":true,"locationContextEnabled":false,"warnings":{},"desired":{"app":"D:\\software\\adt-bundle-windows\\sdk\\platform-tools\\app_installed\\kuaiqianqianbaoapp.apk","deviceName":"HUAWEI GRA-UL00","platformName":"Android","appActivity":"com.bill99.kuaiqian.ui.base.WelcomeActivity","noSign":true,"appPackage":"com.bill99.kuaiqian"},"app":"D:\\software\\adt-bundle-windows\\sdk\\platform-tools\\app_installed\\kuaiqianqianbaoapp.apk","deviceName":"T7G5T15427004998","platformName":"Android","appActivity":"com.bill99.kuaiqian.ui.base.WelcomeActivity","noSign":true,"appPackage":"com.bill99.kuaiqian"},"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: --> POST /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f/element {"using":"id","value":"com.bill99.kuaiqian:id/q9"}
> info: [debug] Waiting up to 0ms for condition
> info: [debug] Pushing command to appium work queue: ["find",{"strategy":"id","selector":"com.bill99.kuaiqian:id/q9","context":"","multiple":false}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"find","params":{"strategy":"id","selector":"com.bill99.kuaiqian:id/q9","context":"","multiple":false}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: find
> info: [debug] [BOOTSTRAP] [debug] Finding com.bill99.kuaiqian:id/q9 using ID with the contextId:  multiple: false
> info: [debug] [BOOTSTRAP] [debug] Using: UiSelector[INSTANCE=0, RESOURCE_ID=com.bill99.kuaiqian:id/q9]
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":{"ELEMENT":"1"}}
> info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: <-- POST /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f/element 200 585.720 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: --> GET /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f/element/1/text {}
> info: [debug] Pushing command to appium work queue: ["element:getText",{"elementId":"1"}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:getText","params":{"elementId":"1"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: getText
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"鐞嗚储"}
> info: [debug] Responding to client with success: {"status":0,"value":"鐞嗚储","sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: <-- GET /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f/element/1/text 200 193.723 ms - 80 {"status":0,"value":"鐞嗚储","sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: --> POST /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f/element/1/click {"id":"1"}
> info: [debug] Pushing command to appium work queue: ["element:click",{"elementId":"1"}]
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"action","action":"element:click","params":{"elementId":"1"}}
> info: [debug] [BOOTSTRAP] [debug] Got command of type ACTION
> info: [debug] [BOOTSTRAP] [debug] Got command action: click
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":true}
> info: [debug] Responding to client with success: {"status":0,"value":true,"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: <-- POST /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f/element/1/click 200 3808.115 ms - 76 {"status":0,"value":true,"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: --> DELETE /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f {}
> info: Shutting down appium session
> info: [debug] Pressing the HOME button
> info: [debug] executing cmd: D:\software\sdk\platform-tools\adb.exe -s T7G5T15427004998 shell "input keyevent 3"
> info: [debug] Stopping logcat capture
> info: [debug] Logcat terminated with code null, signal SIGTERM
> info: [debug] Sent shutdown command, waiting for UiAutomator to stop...
> info: [debug] [BOOTSTRAP] [debug] Got data from client: {"cmd":"shutdown"}
> info: [debug] [BOOTSTRAP] [debug] Got command of type SHUTDOWN
> info: [debug] [BOOTSTRAP] [debug] Returning result: {"status":0,"value":"OK, shutting down"}
> info: [debug] [UIAUTOMATOR STDOUT] [CDS]close[4724]
> info: [debug] [UIAUTOMATOR STDOUT] close [socket][/0.0.0.0:4724]
> info: [debug] [BOOTSTRAP] [debug] Closed client connection
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: numtests=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=.
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: id=UiAutomatorTestRunner
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: test=testRunServer
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: class=io.appium.android.bootstrap.Bootstrap
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: current=1
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: 0
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS: stream=
> info: [debug] [UIAUTOMATOR STDOUT] Test results for WatcherResultPrinter=.
> info: [debug] [UIAUTOMATOR STDOUT] Time: 23.808
> info: [debug] [UIAUTOMATOR STDOUT] OK (1 test)
> info: [debug] [UIAUTOMATOR STDOUT] INSTRUMENTATION_STATUS_CODE: -1
> info: [debug] UiAutomator shut down normally
> info: [debug] Cleaning up android objects
> info: [debug] Cleaning up appium session
> info: [debug] Responding to client with success: {"status":0,"value":null,"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}
> info: <-- DELETE /wd/hub/session/80a6ad1b-ed9d-4b75-be4e-31996205002f 200 1154.180 ms - 76 {"status":0,"value":null,"sessionId":"80a6ad1b-ed9d-4b75-be4e-31996205002f"}

 

tips:获取appPackage和appActivity。最直接的方法就是用appium.

 

 

或者运行cmd,到sdk的build-tools目录下,输入aapt d badging D:\software\adt-bundle-windows\sdk\platform-tools\app_installed\kuaiqianqianbaoapp.apk|findstr "package launchable-activity"

 

 参考:

安装环境参考:http://www.cnblogs.com/puresoul/p/4696638.html

转载于:https://www.cnblogs.com/applemoon/p/6245824.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/255656.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C# 事件机制

在所有关于C#事件机制的介绍中&#xff0c;我更倾向于发布者/订阅者&#xff08;Publisher/Subscriber&#xff09;这种描述。理解事件机制并不是一件容易的事情&#xff0c;它所涉及的思想值得我们好好去研究。 本文资源来自《C#与.NET技术平台实战演练》——中国青年出版社 …

【数据库学习】——从零学习SQL语句(含SQL数据类型、SQL语句实例操作)

目录 ​ 0、创建数据库 1、调用指定的数据库 2、创建数据表 2.1、SQL数据类型 1&#xff09;.字符型数据&#xff1a; 3&#xff09;.整数型数据 4&#xff09;.精确小数型数据 5&#xff09;.近似数值类型 6&#xff09;.货币型数据 7&#xff09;.位类型数据 2.2…

struts2学习笔记(常见错误)

1、由于笔者使用的时最新的struts2 (version 2.5.14.1)&#xff0c;之前下载的是all &#xff0c; 一直配置不上&#xff0c;然后查了google才下载的min版本。 这里面有配置struts2需要的必备的jar包&#xff0c;而至于上面的all里面lib里面的jar包实在太多&#xff0c;虽然我…

C#图解教程 第十二章 数组

数组数组定义重要细节数组的类型数组是对象一维数组和矩形数组实例化一维数组或矩形数组访问数组元素初始化数组显式初始化一维数组显式初始化矩形数组快捷语法隐式类型数组综合内容交错数组声明交错数组快捷实例化实例化交错数组比较矩形数组和交错数组foreach语句迭代变量是只…

【数据库学习】——windows、MySQL构建新闻管理系统(控制台版)

学习记录&#xff1a;【Python项目实战】PythonMySQL开发新闻管理系统全集_哔哩哔哩_bilibilihttps://www.bilibili.com/video/BV1Qb4y1b75q?p2&spm_id_frompageDriver 目录 一、项目介绍 1、项目结构 2、系统部分功能提前展示 3、项目流程图 4、项目设计的数据库以及…

微信红包API接口(PHP)

发布时间&#xff1a;2015年2月25日 / 分类&#xff1a;WEB开发,PHP / 74,825 / 241 ℃ 根据微信高级红包接口&#xff0c;开发PHP版本的API接口&#xff0c;现在进行主要代码分析。 红包接口调用请求代码&#xff0c;所有请求参数为必填参数与文档对应&#xff1a; 1234567891…

2016年个人技术总结(前端)

自我总结 参与项目 备注:[☆-表示比较吊的项目,-从头开始做,^-中间加入项目] 神马生活(微信公众号商城)[^] 神马学院[] <!------跳槽线--------> 大数据套件[☆][^] fable数据营销平台(加入新功能&#xff0c;交互)[^] fit问卷系统[] fit投放系统[] fit画像[^] 理财通点击…

彩色CCD相机工作原理

原理 黑白&#xff08;单色&#xff09;相机 CCD原理并不复杂。我们可以把它想象成一个顶部被打开的记忆芯片。因此光束可以射到记忆单元中。根据"光电效应”&#xff0c;这些光束在记忆单元中产生负电荷&#xff08;下图中右上部分&#xff09;。 曝光后&…

【HTML学习】——HTML常见标签属性和方法介绍

目录 1、HTML分块--------< div> 2、HTML段落--------< p> 3、HTML标题--------< h1>…< h6> 4、HTML链接--------< a> 1)< a href“http://www.baidu.com”>百度< /a>&#xff08;点击百度&#xff0c;直接跳转到网页&#xf…

开发者应警惕的七种糟糕职业规划错误

那些心灵鸡汤式的说辞总爱美化失败&#xff1a;失败是成功之母啦、失败使人成长啦、别畏惧失败等等。但事实上&#xff0c;这种思路在软件开发领域也许并不适用——至少不完全适用。每位开发者在职业生涯中都不可避免会遭遇失败&#xff0c;但为什么不从他人的经验中汲取教训来…

【HTML学习】——一个网页HTML编程的构成

目录 1、html网页构成介绍 2、HTML标签介绍 全部的html标签&#xff1a; HTML: HyperText Markup Language | MDNhttps://developer.mozilla.org/en-US/docs/Web/HTML 一个网页文件一般由.html结尾的文件组成&#xff0c;主要由不同的标签对和内容组成&#xff0c;常见的html…

hbase里插入big int数据用Phoenix查看的报错问题

Phoenix建表create table "test_big_int"("ROW" varchar primary key,"ci"."column1" bigint) 在hbase里put数据hbase 里面进行put: put test_big_int,001,ci:column1,1 在Phoenix里进行查看&#xff08;问题出现&#xff09;第二个尝…

机器学习:利用卷积神经网络实现图像风格迁移 (一)

相信很多人都对之前大名鼎鼎的 Prisma 早有耳闻&#xff0c;Prisma 能够将一张普通的图像转换成各种艺术风格的图像&#xff0c;今天&#xff0c;我们将要介绍一下Prisma 这款软件背后的算法原理。就是发表于 2016 CVPR 一篇文章&#xff0c; “ Image Style Transfer Using Co…

博客园自定义样式

碎碎念&#xff1a; 已经很长时间没有更新过博客了&#xff0c;分析一下&#xff0c;一个是太懒了。。。所以很久没整理一下了。还有就是嫌弃博客园默认的博客界面真的太丑了&#xff0c;作为颜控的我真的无法忍受啊。个人比较喜欢用makedown来编写博客&#xff0c;但是博客园自…

【CSS】——cascading stylesheets层叠式样式表

目录 0、CSS介绍 1、CSS语句组成 2、CSS选择器的选择方式 1&#xff09;CSS选择器的方式和选择器大全&#xff1a; 2&#xff09;常见的三种方式&#xff1a; 3、添加CSS方式 1&#xff09;外部样式表 html调用css代码 css文件 html文件 展示 2&#xff09;内部样式表…

四 Apache Axis2 部署 WebService

最新版本1.7.4发布日期2016-10-21 Axis2官网下载如下文件&#xff1a; axis2-1.6.2-bin&#xff1a;二进制的axis axis2-1.6.2-docs&#xff1a;帮助文档 axis2-1.6.2-war&#xff1a;axis.war 文件 axis2-eclipse-codegen-plugin-1.6.2&#xff1a;Eclipse axis client 插件 a…

安装OpenCV:OpenCV 2.4.8或OpenCV 2.4.9 +VS 开发环境配置

因为读研期间的研究方向是图像处理&#xff0c;所以浅墨这段时间闭门研究了很多OpenCV和图像处理相关的知识与内容。眼看自己积累到一定的程度了&#xff0c;于是决定开始开设这个OpenCV系列专栏&#xff0c;总结自己所学&#xff0c;也分享知识给大家。 好了&#xff0c;这篇文…

powerdesigner中如何在自动生成建表SQL时添加模式名schema

1、在主菜单中选择“模型”→“users and roles”→“users”&#xff0c;新增一个user&#xff0c;其中"name"字段就是要添加的模式名。 2、在新增表时&#xff0c;在表属性的“general”页签中选择"owner"&#xff0c;选择刚才新增的user&#xff0c;即可…

【django学习】——Django介绍和实战(开发简易版博客网页)

目录 0、视频链接 1、环境配置 2、django基本命令 1&#xff09;常见命令 2&#xff09;数据库相关的Django命令 3、Django项目 1&#xff09;Django创建项目 2&#xff09;项目目录介绍 3&#xff09;运行初始化的Django项目 4、Django应用 1&#xff09;Django项目和Djan…

求最大子数组03

题目: 返回一个二维整数数组中最大联通子数组的和。 要求&#xff1a; 1. 输入一个二维整形数组&#xff0c;数组里有正数也有负数。 求所有子数组的和的最大值。要求时间复杂度为O(n)。 2.程序要使用的数组放在一个叫 input.txt 的文件中&#xff0c; 文件格式是: 数组的行…