Appium Environment Construction (II.)

Source: Internet
Author: User

8. Test Scripts

(1) Open the SDK Manager.exe, open Android Virtual device manager-> Create simulator->start

(2) Add operation to "Calculator" in simulator

Open "Python", "IDLE" new script

#coding =utf-8

From Appium import Webdriver

From Appium.webdriver.mobilecommand import Mobilecommand

Import time

Import OS

Desired_caps = {}

desired_caps[' platformname ' = ' Android '

desired_caps[' platformversion '] = ' 4.4.2 '

desired_caps[' devicename '] = ' emulator-5554 '

desired_caps[' apppackage '] = ' Com.android.calculator2 ' #被测App的包名

desired_caps[' appactivity '] = '. Calculator ' #启动时的Activity

desired_caps[' unicodekeyboard ') = True

desired_caps[' resetkeyboard ') = True

desired_caps[' newcommandtimeout '] = 7200

Driver = Webdriver. Remote (' Http://localhost:4723/wd/hub ', desired_caps)

driver.find_element_by_id ("Com.android.calculator2:id/digit2"). Click ()

driver.find_element_by_id ("Com.android.calculator2:id/plus"). Click ()

driver.find_element_by_id ("COM.ANDROID.CALCULATOR2:ID/DIGIT4"). Click ()

driver.find_element_by_id ("Com.android.calculator2:id/equal"). Click ()

Driver.quit ()

(3) Open->android settings for Setup

(4) Start appium-server-> Run script

Appium Environment Construction (II.)

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.