Appium Test APK

Source: Internet
Author: User
Tags appium

Introduced

Appium is an open-source, cross-platform testing framework that can be used to test native and hybrid mobile applications. Appium supports iOS, Android and Firefoxos platform testing. Appium uses Webdriver's JSON wire protocol to drive the UIAutomation Library of the Apple system and the Uiautomator framework of the Android system.

Characteristics:

    • Cross-architecture
    • Cross-device
    • Cross-language
    • Cross App
    • Do not rely on source code
    • Unlimited test frameworks and platforms

Real-world applications (Android platform for example)

1. Installing the JDK

I'm faking the jdk1.8.0_20.

2. Install Android Studio and use the SDK

3. SDK Environment Configuration

1) Create a new variable android_home in the system variable of the environment variable, and the variable value is the ADK corresponding path

2) Click Edit System variable path to add SDK tools and Platform-tools

3) Click OK, run ADB devices under CMD

The following is correct.

If only the list of devices attached is displayed, enter ADB connect 127.0.0.1:62001 on the command line, and then enter ADB devices

4. Install simulator (mimic Android environment)

Can use the Android comes with the simulator, here I use the night God Simulator (relatively smooth)

5, start the simulator, the desktop appears

6. Install Python

7, Installation Appium

8, installation Appium-client

Note: The IP command needs to be used in the Python scripts directory (because Pip.exe is there)

CMD under jump to Python's script directory, enter pip install appium-client, then install automatically

9, double hit open android_home/tools under the Uiautomatorviewer.bat

The following interface appears

Click the second button in the top left corner to display the interface in the emulator

If the error is usually due to ABD problem, then repeat the 3, 3) steps can be resolved

This app allows you to locate the elements in the APK, making it easy to write Python scripts

Uiautomator specific methods of use:

    • First find index, then find text, if you can not find then try to find Resource-id, do not try to find the parent class, and then can only be through the coordinates

    • Positioning by Xpyth:

      Findelementbyxpath ("//android.widget.textview[10]") XPath subscript starting from 1, using the full classname

    • Location by ID: Findelementbyid ("com.xwtec.zhy.xwlottery:id/grid_item_tv_red");
    • Find_element_by_name (name corresponds to the content of the text after Uiautomator scan)
    • find_element_by_id (ID corresponds to Resource-id)

    • Find_element_by_class_name (class_name corresponds to Class)

    • FIND_ELEMENT_BY_ACCESSIBILITY_ID (accessibility_id corresponds to CONTENT-DESC)

    • Navigate to a text box and enter the contents:

      Text = driver.find_element_by_id ("Com.changhong.smartalbum:id/passwd_edit") Text.send_keys ("123456")

    • Slide Screen:
      • Get screen size width=self.driver.get_window_size () [' Width '] height=self.driver.get_window_size () [' Height ']
      • Sliding screen driver.swipe (WIDTH*9/10, HEIGHT*1/2, WIDTH*1/10, HEIGHT*1/2, 1000)

Appium Test APK

Related Article

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.