Appium Basic--one Demo

Source: Internet
Author: User

Launch Simulator, launch Appium Android AVD launch simulator admin Select a version start install appium-client direct pip install appium-python-client install simple script: Calculator parameters:platformname = Android #Android or iOS platformversion = version number of the 4.2 #android devicename = Android Emulator # emulator or device ID apppackage = com. Hunbohui.yingbasha #apk package name appactivity =. Component.menu.HomeActivity # boot name Webdriver. Remote ('http://localhost:4723/wd/hub', capabilities) The first parameter is fixed write OK, if using the remote machine to do the test,localhosts to the corresponding machine IP can be how to get Apppackage and appacitvity:1. Get Apppackage This is actually the name of the installation packageunder Android folder tools find Uiautomatorviewer and open, in the case of a linked phone, click:

this will get the current screenin the lower right detail you can find the package Com.android.calculator2, which is the name2. Get appacitvityCMD input: adb shell Dumpsys activity activities find this, use/split, front is package, behind isappacitvityHow to obtain the device number DeviceNamecmd under run ADB devicesThis is the device number .
# encoding=utf-8from Appium Import Webdriver desired_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 ()

Appium Basic--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.