Giter Club home page Giter Club logo

snippet-uiautomator's Introduction

Snippet UiAutomator

Latest release APK Build Status Python Build Status

This is the Python wrapper based on Mobly Snippet Lib for calling the AndroidX UiAutomator APIs.

Requirements

  • Python 3.7+
  • Android 8.0+ (SDK 26+)

Installation

pip install snippet-uiautomator

Initial Mobly Android Controller

  • Inside Mobly Test

    To use in a Mobly test, the Android device needs to be initialized in the Mobly base test.

    from mobly import base_test
    from mobly.controllers import android_device
    
    class MoblyTest(base_test.BaseTestClass):
      def setup_class(self):
        ad = self.register_controller(android_device)[0]
  • Outside Mobly Test

    If not using in a Mobly test, such as when running in a Python terminal, the Android device can be initialized with its serial number.

    from mobly.controllers import android_device
    
    ad = android_device.AndroidDevice('GOOG1234567890')

To learn more about Mobly, visit Getting started with Mobly.

Launch UiAutomator Service

Snippet UiAutomator supports launching as one of Mobly Android Device Service.

from snippet_uiautomator import uiautomator

ad.services.register(
    uiautomator.ANDROID_SERVICE_NAME, uiautomator.UiAutomatorService
)

ad.ui(text='OK').click()

Test

Run unit tests for Python part:

pytest

Run tests for Snippet part:

cd snippet_uiautomator/android
./gradlew test

Set up pre-commit hooks, this will run some automated checks during each git commit and possibly update some files that require changes:

pip install pre-commit
pre-commit install

API Usage

snippet-uiautomator's People

Contributors

dpeykov avatar dshiroma avatar eric100lin avatar ko1in1u avatar yangwk4464 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

snippet-uiautomator's Issues

Support takeScreenshot (missing function) in UiDeviceSnippet.java

most functions are exposed as RPC from uiautomator uidevice, but some functions like takeScreenshot etc is missing from UiDeviceSnippet.java. We may fork one to add it, but it is nice if the repo can add it. If any one can create a PR to fix it, that would be appreciated

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.