【Appium】Environment for getting started with appium automation (below)

The rest of the appium environment is estimated to be completed. This article can be finished.

Thinking about Appium, there is still a lot to say, justapi commandJust a lot, andElement positioningwhat,Packagewhat,Build on mac or iosWait

Book above
[Appium] Setting up the environment for
getting started with appium automation (part one)

text

1.4 pycharm environment

Introduction

Before writing a script, find a handy scripting tool. Python is an interpreted programming language, so generallyCall the tool for writing python an interpreter.
There are many tools for writing python scripts, I will not list them all here, as long as you use them easily, if you have not selected an interpreter, I recommend herepycharm

After installing pycharm, there are some friends who can’t crack it.Recommend everyone to buy genuine.
Of course, if you don't want to pay and want to crack pycharm, it is also very easy. Here is a cracking method.
The premise is that you wantDownload the pycharm installation package firstInstallation package can go to the official website to download the latest version.

1.4.1 Cracking pycharm

  1. Install pycharm Don't move at the registration interface
  2. Adjust the computer system time to 2036(20 years should be enough).
  3. Registration interface selectionApply for a 30-day trial
  4. Exit pycharm
  5. The computer time is adjusted back.
    Insert picture description here

Let's start the pycharm journey~

1.4.2 New project

  1. ind driveCreate a new test folder

  2. Open the File button in the upper left corner of pycharm

  3. Click New Project to create a new project
    -

1.4.3 New script

  1. Right-click on the menu tree on the left side of pycharm and create a new Directory (folder)

  2. Select the corresponding folder and create a new Python File (script file) in the folder.

  3. Name the script by yourself, == suffix .py == will be automatically brought out

Insert picture description here

1.4.4 Start programming

  1. Double-click to open the script to be written
  2. Enter in the edit box on the right: print("hello world!")
  3. Click the title of the script, right-click and select Run "test01", the results are as follows
    Insert picture description here

1.5 android emulator AVD

Introduction

Emulator on computer
Insert picture description here

1.5.1 Simulator configuration

  1. Double-click to start AVD Manager and enter the configuration interface

  2. Click the Create button to create
    Insert picture description here

  3. Configure basic simulator information

  • AVD Name: Device name, define one by yourself,Use English (do not use Chinese)
  • Device: Device model, the option in the following figure means, == 4.7 inch mobile phone, 768*1280 resolution, screen density: xhdpi ==
  • Target:Select the corresponding API version number, Android version number 4.4.2, corresponding to API version 19
  • CPU / ABI: cpu model number
  • Keyboard: This is best checked, with keyboard buttons
  • Skin: Skin settings, set at will
  • Front Camera: Front camera, set to None
  • Back Camera: Back camera, set to None
  • Memory Option: RAM running memory, just set 512, VM Heap is the default setting of 64 for app running memory.
  • Internal Storage: The size of the memory card of the phone itself
  • SD Card: the internal memory of an external SD card
    Insert picture description here
  1. After setting, click OK to save, and the following interface will pop up to indicate that the save is successful
    Insert picture description here

1.5.2 Start the simulator

  1. Select the successfully created simulator above, click the start button, and then click the Launch button to start
    Insert picture description here

2. The next step is to wait patiently for a few minutes (5-10 minutes if the computer performance is not good), the following interface appears after successful operation
Insert picture description here

3. Seeing the above interface shows that the startup is successful, and then just click and click as usual to operate the phone, then use the adb tool to check the device, open the cmd input

adb devices

Insert picture description here

At this point, the simulator starts successfully, which replaces the real machine and the data cable to connect to the computer.
If you have any questions during the learning process,canClick and enter the password: CSDN

1.6 Use of adb (must know and know)

Introduction

To learn automated testing, adb is a must,There are several commonly used instructions that need to be mastered

1.6.1 Check the equipment

1. How to check if the phone (or emulator) is connected to the computer, type in cmd:

adb devices

Insert picture description here

2.Be sure to see the red area in the picture above, the device name, and then the device (if you see offline here, then the adb port is occupied)

1.6.2 Install app

  1. How to install the app to the android emulator on the computer?
  • Step 1: Download the apk file package and put it on the desktop
  • Step 2: Enter the path of adb install app in cmd port
  • Step 3: Drag the apk package to the cmd window and press Enter to install
    Insert picture description here
  1. After the installation is successful, you will see Success and Taobao app will appear on the simulator
    Insert picture description here

1.6.3 Uninstall app

1. Enter the following command in cmd to delete the app

adb uninstall package name (here is the package name of the app, not the file name. Use the aapt tool to view the package name)

2. Take Taobao as an example, the package name of Taobao is: com.taobao.taobao
Insert picture description here

1.6.4 Several other commands

  1. Kill adb process
    adb kill-server
  2. Restart the adb service
    adb start-server
  3. Restart the phone
    adb reboot
  4. Enter shell mode
    adb shell
  5. Mount
    adb remount
  6. Send files from computer to mobile phone
    adb push <local path> <remote path>
  7. Download files from mobile phone to local
    adb pull <remote path> <local path>
  8. Output log
  • The first type: output to mobile phone storage card adb logcat> /sdcard/mylogcat.txt
  • The second type: output to the computer adb logcat> D:/Temp/1.txt (txt must exist on the computer before the logcat content can be written)

Afterword

There are too many adb instructions, take time to publish an article dedicated to adb instructions. If you have any questions, you can click and enter the password: CSDN

Insert picture description here
The next trailer:API instructions and element positioning

Guess you like

Origin blog.csdn.net/Chaqian/article/details/108984997