Reference Tutorial: Appium Beginner (5)--python-client Installation and testing
Writing Appium automated test scripts using the Python language
1. Install Python
Visit the official website of Python: https://www.Python.org/
Always point to next until finish.
Configure environment variables: My Computer-Properties-Advanced system settings-environment variables-System variables-find path, add variable value: C:\Python27
Open the Windows Command window, enter Python, display the Python version representation, and so on.
2. Installing Appium-client (appium-python-client)
The Appium client is a few extensions and encapsulation of the Webdriver native API. It can help us to write use cases more easily and write better use cases.
The Appium client is used in conjunction with the native Webdriver, so they must be used in conjunction with
Installation: Pip Install Appium-python-client
3. First Automation script
A. Launch the Android emulator
B. Start Appium
Click the triangle button in the upper right corner, note that the Appium startup log, Appium at startup, the default occupation of the native port 4723, that is: 127.0.0.1:4723
4. Writing automated test scripts using Python
#Coding=utf-8 fromAppiumImportWebdriverdesired_caps={}desired_caps['PlatformName'] ='Android'desired_caps['platformversion'] ='4.4.2'desired_caps['devicename'] ='Android Emulator'desired_caps['Apppackage'] ='Com.android.calculator2'desired_caps['appactivity'] ='. Calculator'Driver= Webdriver. Remote ('Http://localhost:4723/wd/hub', Desired_caps) driver.find_element_by_name ("1"). Click () driver.find_element_by_name ("5"). Click () driver.find_element_by_name ("9"). Click () driver.find_element_by_name ("Delete"). Click () driver.find_element_by_name ("9"). Click () driver.find_element_by_name ("5"). Click () driver.find_element_by_name ("+"). Click () driver.find_element_by_name ("6"). Click () driver.find_element_by_name ("="). Click () driver.quit ()
First run when the first line of code in the script error: Error:no module named Appium
This error is reported because the client is not installed, the other I have installed, look at the picture
Just ah, I use python27 hahaha, all the files under the path copied into the python27 can be,,,
Stumbling finally completed the first trot, time long ah, refueling!!!
Appium Mobile Automation Test-one Demo