airtest.devsuit
index
/home/hzsunshx/workspace/airtest/airtest/devsuit.py

# -*- coding: utf-8 -*-

 
Modules
       
PIL.Image
airtest
airtest.base
collections
airtest.image.auto
airtest.image.sift
airtest.image.template
json
os
platform
airtest.proto
threading
time

 
Classes
       
__builtin__.object
DeviceSuit

 
class DeviceSuit(__builtin__.object)
     Methods defined here:
__getattribute__(self, name)
__init__(self, device, devClass, phoneno, appname=None, logfile='log/airtest.log', monitor=True)
center(self)
Center position
click(self, SF, seconds=None, duration=0.1)
Click function
@param seconds: float (if time not exceed, it will retry and retry)
clickIfExists(self, imgfile)
Click when image file exists
 
@return (True|False) if clicked
drag(self, fpt, tpt, duration=0.5)
Drag from one place to another place
 
@param fpt,tpt: filename or position
@param duration: float (duration of the event in seconds)
exists(self, imgfile)
find(self, imgfile)
Find image position on screen
 
@return (point founded or None if not found)
findall(self, imgfile, maxcnt=None, sort=None)
Find multi positions that imgfile on screen
 
@maxcnt (int): max number of object restricted.
@sort (string): (None|x|y) x to sort with x, small in front, None to be origin order
@return list point that found
@warn not finished yet.
globalGet(self, key)
get app setting
globalSet(self, *args, **kwargs)
app setting, be careful you should known what you are doing.
@parma m(dict): eg:{"threshold": 0.3}
keepCapture(self)
Use screen in memory
keyevent(self, event)
Send keyevent (only support android and ios)
 
@param event: string (one of MENU,BACK,HOME)
@return nothing
log(self, tag, message)
mustFind(self, imgfile)
Raise Error if image not found
releaseCapture(self)
Donot use screen in memory (this is default behavior)
safeWait(self, imgfile, seconds)
Like wait, but don't raise RuntimeError
 
return None when timeout
return point if found
shape(self)
Get device shape
 
@return (width, height)
sleep(self, secs=1.0)
Sleeps for the specified number of seconds
 
@param secs: float (number of seconds)
@return None
takeSnapshot(self, filename)
Take screen snapshot
 
@param filename: string (base filename want to save as basename)
@return string: (filename that really save to)
type(self, text)
Input some text
 
@param text: string (text want to type)
wait(self, imgfile, seconds=20)
Wait until some picture exists
@return position when imgfile shows
@raise RuntimeError if not found

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
rotate_point((x, y), (w, h), d)
@param (x,y): input point
@param (w,h): width and height
@param d(string): one of UP,DOWN,LEFT,RIGHT
@return (x, y): rotated point

 
Data
        log = <logging.Logger object>