-
Notifications
You must be signed in to change notification settings - Fork 15
1. API Reference
Konrad Staniszewski edited this page Jun 3, 2019
·
2 revisions
Source Code can be found in the GitHub Wiki
class Device():
# """
# This is the class that allows all the other funcitons to be called.
# Args:
# deviceID (str): The id of the device. Determined using `adb devices`
#"""
def inputTap(x, y, (optional) percent=True):
# """
# Function that inputs a tap at the (x,y) coordinates provided.
# These can be viewed by turning on the taps and swipes option in developer options
# Args:
# x (int): x coordinate
# y (int): y coordinate
# Optional Args:
# percent="True" (False by default): Sets the x,y input mode to percent of screen size
# """
def inputSwipe(x1, y1, x2, y2, (optional) time, percent=True):
# """
# Function that inputs a swipe starting at (x1, y1) and going to (x2, y2)
# Args:
# x1 (int): x coordinate of beginning location of swipe
# y1 (int): y coordinate of beginning location of swipe
# x2 (int): x coordinate of end location of swipe
# y2 (int): y coordinate of end location of swipe
# Optional Args:
# time (int): the time (ms) to perform swipe. Default: 200ms
# percent="True" (False by default): Sets the x, y input mode to percent of screen size
# """
def inputText(text):
# """
# Function that inputs text without opening a keyboard on the phone
# Args:
# text (str): Text to input
# """
def pressHome():
# """
# Function that pressed the center home button on your device
# """
def pressBack():
# """
# Function that pressed the back button on your device
# """
def pressPower():
# """
# Function that presses the power button on your device
# """
def wakeup():
# """
# Function that wake's your device if it is not already awake
# """
def sleep():
# """
# Function that puts your device to sleep if it is awake
# """
def volumeUp():
# """
# Function that presses the volume up button on your device
# """
def volumeDown():
# """
# Function that presses the volume down button on your device
# """
def keycodeEvent(keycode):
# """
# Function that inputs a keycode to the device. A reference list for keycodes can be
# found in the Github Wiki
# Args:
# keycode (str/int): The string or integer description of the wanted keycode
# """
def tapNode(nodeName):
# """
# Function that inputs a tap on the item described by its content-desc
# Args:
# nodeName (str): the content-desc of the node or the text
# """
def inputRandom(app, numEvents):
# """
# Function which uses the monkey runner module to open an app and input random events
# Args:
# app (str): which app to launch for random input
# numEvents (int): number of random inputs to inject
# """
def listEvents():
# """
# Function that lists the contents of the /events/ folder
# """
def recordEvent(event):
# """
# Function that records Touchscreen input until CTRL-C is typed into the terminal
# Args:
# event (str): Name of file to which the event will be saved.
# """
def playEvent(event):
# """
# Function that plays back a recorded event
# Args:
# event (str): Name of the recorded file to play
# """
def listApps():
# """
# Function that will list all of the installed packages on your device
# """
def searchApp(search):
# """
# Function that allows you to search your device for an app. Returns the name of the app
# Args:
# search (str): A search criteria that will grep through the output of the command
# `adb shell pm list packages`
# """
def launchApp(app):
# """
# Function that launches an app
# Args:
# app (str): Launches the supplied app. Apps may be listed in the CLI with listApps()
# """
def closeApp(app):
# """
# Function that closes an app
# Args:
# app (str): Closes the supplied app. Apps may be listed in the CLI with listApps()
# """
def detEventId():
# """
# Function that self determines the eventId of the touch screen of the device.
# IMPORTANT NOTE: eventId is determined by the first device that has the name "touch" in it.
# It can be set manualy with myDevice.eventId = <eventId>
# returns:
# eventId (str): the number corresponding to the touch screen eventId
# """
def screenSize():
#"""
# Function that self determines the screen size of the device.
# Returns:
# width (str): the width of the device in pixels
# height (str): the height of the device in pixels
#"""
def parseScreenXML():
# """
# Function to parse the current view for clickable nodes
# Returns:
# nodes (list of node objects): a list of node objects for further processing
# """