appium 环境搭建 java
1 安装node.js
1.1 安装node.js
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添加:
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; @Before
public 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); } @Test
public void test() {
WebElement licai = driver.findElementById("com.bill99.kuaiqian:id/q9");
System.out.println("控件文本"+licai.getText());
licai.click();
} @After
public 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
appium 环境搭建 java的更多相关文章
- Appium环境搭建Java篇
1.下载.安装JDK&配置Java环境变量 JDK下载地址:http://www.oracle.com/technetwork/java/javase/downloads/index.html ...
- Robot framework + appium环境搭建
Robot framework+appium环境搭建 首先梳理一下要用到的工具和安装包: 1. Android + JAVA. jdk : http://www.oracle.com/technetw ...
- RF+Appium框架自动化测试系列一之(Mac下Appium环境搭建)万事开头难
消失了3个月,有一段时间没来园子更新博客了,各位看官见谅哈哈,消失是因为刚换了工作环境没外网,好多笔记没能及时的记录分享,以后有时间慢慢补上吧,这段时间主要接触了移动端app的自动化测试,公司为了快速 ...
- Appium python自动化测试系列之appium环境搭建(二)
2.1 基础环境搭建 当我们学习新的一项技术开始基本都是从环境搭建开始,本书除了第一章节也是的,如果你连最基础的环境都没有那么我们也没必要去说太多,大概介绍一下: 1.因为appium是支持andr ...
- Python + Appium 环境搭建
---恢复内容开始--- Appium自动化公司内部测试培训1-环境搭建 课程目的 一.Python + Appium 环境搭建 课程内容 1 安装前准备工作 搭建环境所需要的安装文件已经下载好 ...
- (干货分享)mac python+appium环境搭建
因为mac本自带python2.x(不建议卸载,因为本本本身有很多依赖与此),所以装python3的过程极其坎坷,勉强装好后也总是各种报错.这次装appium环境,直接把原来的python3卸了,用h ...
- 基于Python的Appium环境搭建合集
自动化一直是测试圈中的热聊,也是大家追求的技术方向.在测试中,往往回归测试也是测试人员的“痛点”.对于迭代慢.变更少的功能,就能用上自动化来替代人工回归,减轻工作量. 问题 在分享环境搭建之前,先抛出 ...
- Mac Appium环境搭建
安装brew ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" 安装java brew install ...
- Appium环境搭建(win/mac)
课程使用Windows+Android虚拟机, 建议使用Windows系统学习课程, 如使用Mac系统, 请另外准备一台Andorid手机 Windows系统Appium环境搭建 安装JDK并配置环境 ...
随机推荐
- adb catlog>d:\log.txt日志级别
W,警告 I,通知 D,调试 E,错误 V, 到最细的日志 功能测试可以看W和E,性能测试I比较有用
- MySQL数据库6 -查询基础,简单查询,条件查询,对查询结果排序
一.SELECT语句 SELECT COL1,COL2,....COLn FROM TABLE1,TABLE2,....TABLEn [WHERE CONDITIONS] -- 查询条件 [GROUP ...
- .NET连接SAP系统专题:BAPI_TRANSACTION_COMMIT的使用方法(十)
from:http://scnblogs.techweb.com.cn/mengxin/archives/5.html 为什么.net调用SAP的BAPI接口需要调用BAPI_TRANSACTION_ ...
- SQL Server 简介
什么是数据库? 数据库(Database)是按照数据结构来组织.存储和管理数据的仓库.是以一定方式储存在一起.能为多个用户共享.具有尽可能小的冗余度的特点.是与应用程序彼此独立的数据集合. SQL S ...
- 怎么在excel中快速查找重复记录
假设数字在A列,数字从A1开始:方法一:辅助列中输入公式,数据重复时会出现“重复”提示.=IF(COUNTIF(A:A,A1)>1,"重复","") ,下 ...
- android view : window
既然是view,为什么要说window,实际上着是一个很有用的东西,在展现view和设计界面上很有用,就比如说悬浮窗 但是这时候又要分清楚一个概念,window到底是什么?在activity中说过了我 ...
- [转]Jenkins使用 管理节点
现在我们已经搭建好了基本的Jenkins环境,在这一集里,我们说一说如何管理节点. 进入“系统管理”中的“管理节点”. 创建Windos系统的奴隶节点 先创建一台安装了Win7系统的虚拟机,作为Jen ...
- webview加载h5,关闭activity时,窗体泄露问题
问题描述: webview加载一个含有input控件的html页面,当点击input控件是回调app的closepage方法[closepage中只有一个finish操作],出现窗体泄露问题. 分析: ...
- Linux初学---->WinSCP+Putty
十二是个初学者,就觉得有意思.所以学下Linux.如果有啥不对的情路过大牛多多指点.心中也开始学着写博客,因为觉得博客对于学习技术不仅是个记录,还是对学的东西一个复习,一个反思,一个交流.另如果有好的 ...
- NSCharacterSet在字符串操作中得使用
NSCharacterSet以及它的可变版本NSMutableCharacterSet,用面向对象的方式表示一组Unicode字符,它经常与NSString及NSScanner组合起来使用,在不同的字 ...