Appium mobile automation test (2) appuim + night god simulator

After the environment is set up, you can start mobile automation. But using the built-in AVD to open the emulator is too slow. So instead of using the night god, it can be slightly faster.

  1. start appuim

    Open Appium and click the Start button in the upper right corner

    

    The following information is output, indicating that the startup is successful

    

    2. Link NoxPlayer

      1). First start the night god simulator

      2) Go to the installation directory and link the simulator

        

      Notice: 

      If the adb version of the night god simulator is inconsistent with the adb version of the androidsdk, you need to copy the adb.exe in the platform-tools directory of the androidsdk to the bin directory of the simulator, and modify it to nox_adb.exe

 

    3. Get the package

      There is a uiautomatorviewer.bat tool under sdk/tools

      

      How it looks after startup

      

      There are four buttons in the upper left corner, which are used to open local files, dump pages, dump compressed pages, save

      Select the dump mode of the third button, the right side shows the form of the tree, which looks a lot of introduction, which is convenient to find and view elements.

      

      In addition, there is a tree structure of the list on the right side of the page. Click any control to display the detailed information of the control at the bottom right. The tree structure also supports the search function, but the content of the content-desc is searched.

     4. Get the activity of the apk

      There is a tool hierarchyview.bat in the apk/tools directory, which can get the package and activity information of the current page of the device

      

      Among them, "com.Qunar" is the corresponding package, and "com.mqunar.atom.hotel.ui.activity.HotelListActivity" is the activity of the current page

 

      back up plan:

      The hierarchy view is often unable to connect to the real machine or simulator, and cannot obtain the activity, so directly use the adb command to view the currently running activity

      1. Enter in the cmd command: adb shell to enter the shell command mode
      2. Enter in the shell: logcat | grep ActivityManager Run the application on the real machine, you can view the currently running Activity in real time;

      I/ActivityManager( 511): START u0 {act=Android .intent.action.INSERT dat=content
      ://com.example.notepad.provider.NotePad/notes cmp=com.example.android.notepad/.N
      oteEditor} from pid 12896
      cmp=com.example.android.notepad/ In .NoteEditor, 
      com.example.android.notepad is the package name, and NoteEditor is the currently active activity;

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324515132&siteId=291194637