zoukankan      html  css  js  c++  java
  • Android 自动化

      

    1. 安装Node.js

    安装包路径:https://nodejs.org/download/release/latest-v8.x/

    安装后,验证:type “node –v” in cmd

    2. 安装Android SDK

    安装包路径:http://tools.android-studio.org/index.php/sdk

    解压到“android-sdk”,然后打开SDK Manager.exe 安装 tools, platform tools

    设置环境变量:ANDROID_HOME: D:Program Files (x86)android-sdk

                             Path: ;%ANDROID_HOME%platform-tools;%ANDROID_HOME% ools

    Note

       Android Studio: http://www.android-studio.org/

    3  安装JDK

    安装包路径:http://www.oracle.com/technetwork/java/javase/downloads/index.html

    安装后设置环境变量:JAVA_HOME:C:Program FilesJavajdk1.8.0_144

                                                       Path: ;%JAVA_HOME%in;%JAVA_HOME%jrein

    安装 Apache Ant

    安装包路径:http://ant.apache.org/bindownload.cgi

    解压后设置环境变量:ANT_HOME: D:Program Files (x86)apache-ant-1.10.1

                                                    Path: ;%ANT_HOME%in

    验证:type “ant”, “ant –v” in cmd

    5  安装.net 4.5

    安装包路径:https://www.microsoft.com/net/download/framework

    6  配置Androidappium客户端

    安装包路径:https://bitbucket.org/appium/appium.app/downloads/

                          http://appium.io/

     Method1:

      安装.msi,配置环境变量: path: ; D:Program Files (x86)Appium ode_modules.bin

    Method2:

      输入:cnpm install -g appium@1.6.5 (版本号不写默认下载最新的)

    Type “appium-doctor” to verify, it will prompt “All Checks were successfully”.

    [detailed: http://www.cnblogs.com/ydnice/p/5787800.html]

    7.1 使用Python

    • pip install Appium-Python-Client
    • 开启模拟器 真机 (真机与电脑USB连接,且须开启 USB debugdevice name如下)
    • 打开Appium,在”Android SettingsCapabilities” , Platform version 须与使用的模拟器或真机版本一致;并”Launch Appium Server”
    • 通过Python脚本调用

    Note:

    v   Package: 打开应用程序 -> uiautomatorviewer.bat (android-sdk oolsuiautomatorviewer.bat) -> 查看 package

    v   Activity:

         ① 找源码,问开发者;

         ② 查日志:a) cmd中运行(run as administrator) adb logcat > xxx.log
                           b) 在手机打开App
                          c) cmd中按ctrl-c停止
                          d) xxx.log查找”package/”,后面跟的就有Activity,不过可能会找到很多个,要自己过滤一下

         ③ 先在手机上运行App,再在cmd中执行“adb shell dumpsys window windows”,然后看mFocusedApp这一行的内容,我试过一些不同的App,有一些得出的Activity填到Appium之后,提示不能Launch,但是也可以试试,毕竟比简单。

    元素定位:打开应用程序 -> uiautomatorviewer.bat -> 查看 resource-id

       --- appPackage:

           cmd 下执行“adb shell dumpsys window windows”,AppWindowToken 找出 

           

       --- appActivity

          cmd 下执行 aapt dump badging xxxx.apk, 查找 launchable-activity

          

    7.2 安装Eclipse

    安装包地址:https://www.eclipse.org/downloads/eclipse-packages/?show_instructions=TRUE#page-download,选择” Eclipse IDE for Java EE Developers”

    Open Eclipse.exe, Help -> Install New Software -> Add

    1)   Name: TestNG

    2)   Name: SVN

          Location: https://dl.bintray.com/subclipse/releases/subclipse/latest/

       【建议勾选全部,详见https://github.com/subclipse/subclipse/wiki】

    3)  ADT: link1https://pan.baidu.com/s/1sl2BZit

                   Link2: http://freewareupdate.com/download-android-developer-tools/

          Open Eclipse.exe, Help -> Install New Software -> Add Achieve…, select the zip file and install all. 

         

    Note:  Eclipse -> Window -> Preferences -> Android, set the SDK location to SDK folder, you will see the “Android”, if not, reinstall the ADT. 

    • Install related Android API through Andriod-SDK...SDK Manager, or Eclipse->Window->Android SDK Manager 

    NoteWait till the progress in the right behind corner is done. Can also check from Help -> Install New Software -> Manage.. -> Install/UpdateAvailable Software Sites.

  • 相关阅读:
    Using Repository and Unit of Work patterns with Entity Framework 4.0
    Accessing Your Model's Data from a Controller
    ASP.NET MVC 3 Internationalization
    Test your ASP.NET MVC or WebForms Application on IIS 7 in 30 seconds
    定时执行Web测试
    对包含HttpContext.Current.Cache的代码进行单元测试
    ASP.NET MVC判断基于Cookie的Session过期
    Selenium testing Iframe
    [Tips]: ASP.NET MVC得到controller的名字
    [Tips]:"RemoteOperationException: ERROR: wrong password for user" with Oracle 10g
  • 原文地址:https://www.cnblogs.com/bruce-he/p/10067786.html
Copyright © 2011-2022 走看看