Uiautomatorviewer optimized locator generation, enabling the generation of Java,python Automation code

Source: Internet
Author: User
Tags xpath

Project Introduction

Two times development Uiautomatorviewer optimized locator generation, support the generation of Java,python Automation code, repair the self-brought tool screen has a dynamic load failure problem, optimize the tool speed, to achieve similar recording script function. Compatible with iOS Android.

Software architecture

This tool takes the Android SDK to bring Uiautomatorviewer as the source code base, which is developed in depth two times.

    • Optimize locator XPath generation, extract relatively short XPath, resolve self-tool XPath too long unfriendly problem
    • Fix the bug that comes with uiautomatorviewer error
    • Optimize speed optimization to get XML speed, at least half the original time
    • Support for generating Java,python Automation code to implement similar recording scripting functions, which can be run only when ctrl+c,ctrl+v into your own code
    • Compatible with iOS, Android, real-computer and simulator, you don't need to change tools for Android and Mac platforms, you can use this tool
    • Optimized removal of empty spam nodes in iOS xml, more refreshing positioning elements
Installation Tutorials
    1. This tool and SDK comes with the same jar without Android. If your Mac or Windows system is already installed and configured with the Java1.8 environment
    2. Windows environment, copy the jar to your SDK installation directory Uiautomatorviewer.jar in the same directory (please back up your original jar, general directory in the SDK Tools\lib: \android-sdk-windows\ Tools\lib)
    3. Mac environment, copy the jar to any directory
    4. Android Automation:
    • Copy Lvmamaxmlkit.jar to the local D-packing directory, open the command-line window to execute the command: ADB push d:\lvmamaxmlkit.jar/data/local/tmp/
    • Open the phone file management, to the/data/local/tmp/directory, check to make sure Lvmamaxmlkit.jar is copied to the phone (1)
    • The emulator installs the ADBKEYBOARD.APK and sets the default input method to Adbkeyboard, and turns off the hardware physical keyboard (2)
    • Open your app and click Uiautomatorviewer.bat to start the build Code tour.

Figure 1:lvmamaxmlkit.jar Push success or not check example

Figure 2: Hardware physical keyboard Shutdown Check Example

2. Instructions for use

This tool is developed two times based on the installed Uiautomatorviewer, mainly optimizes xpth extraction, supports the selection of short relative XPath, supports all indexed XPath positioning, and is based on uiselector positioning. After selecting the element, add the right-click menu, provide the common click, input, long press, wait, find elements, keys and other code generation. Before using this tool, please confirm whether ADB can connect to your device, such as not connected, please Baidu self-solve thank you!

    1. Windows environment, and the same Uiautomatorviewer boot method, find your SDK installation directory Uiautomatorviewer.bat (general directory under SDK tools: \android-sdk-windows\ Tools) Double-click to start
    2. Mac environment, open shell Terminal, 1, enter CD XXX into your Uiautomatorviewer.jar placed directory, enter, 2: Enter command: Java-xstartonfirstthread-jar Uiautomatorviewer.jar can be started
    3. Depending on your project needs, select the language you want to generate code for (3)

Figure 3: Language Selection Example

Python code Generation Example
    • Select Python, select the screen element
    • Select Click-->id: Similar no longer repeat, welcome to try to choose Xpath:driver.find_element_by_xpath ("//android.widget.imageview[@content-desc= ' domestic tour ']. Click () Select ID:driver.find_element_by_id ("Com.gift.android:id/search_edit"). Click () Select Desc:driver.find_ ELEMENT_BY_ACCESSIBILITY_ID ("Overseas Tickets"). Click () Select Class:driver.find_element_by_class_name ("Android.widget.TextView" ). Click () Select Text:driver.find_element_by_name ("Play Water Season"). Click ()
Java Code Generation Example
    • For example, after clicking on the ticket, right click, pop-up menu, select click, Pop Up Clickby menu, select Xpth, Generate Driver.findelement ("//android.widget.imageview[@content-desc=" Tickets '] "," XPath "). Click ();

    • Sync Click on Phone, select click (reshot), or longpress (reshot) menu, sync click Emulator and re-intercept screen.

    • Synchronization input, when input is selected, is synchronized in the phone control. More ways to use look forward to your discovery, such as the use of any questions, welcome to discuss the exchange!

Test Exchange Forum: https://testerhome.com/Tools Exchange QQ Group: 610460807

Uiautomatorviewer optimized locator generation, enabling the generation of Java,python Automation code

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.