Appium Mobile Automation Test-one Demo

Source: Internet
Author: User
Tags appium

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.