项目作者: xsoloking

项目描述 :
A lightweight client for appium-uiaotomator2-server
高级语言: Python
项目地址: git://github.com/xsoloking/appium-uiautomator2-client.git
创建时间: 2020-02-26T15:11:20Z
项目社区:https://github.com/xsoloking/appium-uiautomator2-client

开源协议:MIT License

下载


Appium Uiautomator2 Client

This client is a simple implementation written in Python for appium-uiautomator2-server, it should be easy to intergarted into other testing framework.

Installation

Before using this driver, you should build, install and run appium-uiautomator2-server at first.

  • Building appium-uiautomator2-server project using below commands

    ./gradlew clean assembleServerDebug assembleServerDebugAndroidTest

  • Installing both src and test apks to the device and execute the instrumentation tests.

    adb shell am instrument -w io.appium.uiautomator2.server.test/android.support.test.runner.AndroidJUnitRunner

  • Forward tcp port 6790 to local

    adb forward tcp:6790 tcp:6790

Now it is ready to control the device, below are examples

  1. client = AppiumClient()
  2. # Click "test" on screen
  3. client.click_element(client.find_element(ByText("test")))
  4. # Find element by xpath, class name, resrouce id, and uiautpmator statements
  5. client.find_element(ByXpath("//*[@class='android.widget.TextView'][1]"))
  6. client.find_element(ByClass("android.widget.TextView"))
  7. client.find_element(ById("android:id/text1"))
  8. client.find_element(ByUiautomator("new UiSelector().resourceId(\"android:id/text1\")"))
  9. # Tap (x, y)
  10. client.tap(x, y)

ToDo

This client was implemented several yesrs ago, I didn’t test all the fucntions on the latest version of appium uiautomator2 server. So there might be adaption works if the service side has changes.

License

MIT

Free Software, Hell Yeah!