Documentation
¶
Index ¶
- func StartAVD(verified bool, deviceName string) (func(), error)
- func StartAnbox() error
- func XMLtoCoords(xmlcoords string) ([2]int, error)
- type Device
- func (device *Device) Activities(packagename string) []string
- func (device *Device) AutoRotate(rotate bool)
- func (device *Device) ClearApp(app string) error
- func (device *Device) CloseApp(app string)
- func (device *Device) DefaultBrowser(url string) error
- func (device *Device) DeviceReady() bool
- func (device *Device) Exp2Tap(expression string) error
- func (device *Device) Foreground() string
- func (device *Device) GetImei() string
- func (device *Device) HasInScreen(newDump bool, want ...string) bool
- func (device *Device) InputText(text string, splitted bool) error
- func (device *Device) InstalledApp(pkg string) bool
- func (device *Device) IsScreenON() bool
- func (device *Device) NodeList(newDump bool) []string
- func (device *Device) Orientation() (int, error)
- func (device *Device) PageDown()
- func (device *Device) PageUp()
- func (device *Device) PowerButton()
- func (device *Device) Root() error
- func (device *Device) ScreenCap(filename string)
- func (device *Device) ScreenRecord(filename string, duration int)
- func (device *Device) ScreenSize() error
- func (device *Device) ScreenTimeout(waitTime string) (func(), error)
- func (device *Device) Shell(arg string) string
- func (device *Device) Shutdown()
- func (device *Device) StartApp(pkg, activity, options string) error
- func (device *Device) Swipe(coords [4]int)
- func (device *Device) TapCleanInput(x, y, charcount int)
- func (device *Device) TapScreen(x, y, delay int)
- func (device *Device) WaitApp(pkg string, delay, maxRetry int) bool
- func (device *Device) WaitDeviceReady(attemptCount int) error
- func (device *Device) WaitInScreen(attemptCount int, want ...string) error
- func (device *Device) WakeUp()
- func (device *Device) XMLScreen(newdump bool) (string, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StartAVD ¶
StartAVD starts the emulator with the given name
This method requires the Android Studio to be installed and allows the calling to be verified or not
The returned function closes the emulator ¶
ALERT: Requires the emulator to be closed, elsewise the emulator remains active
func StartAnbox ¶
func StartAnbox() error
StartAnbox starts an Anbox Emulator
Before starting it only checks if Anbox is installed ¶
Alert: Does not check if its dependencies are installed
To install dependencies check the link: https://docs.anbox.io/userguide/install_kernel_modules.html
To install Anbox check the link: https://docs.anbox.io/userguide/install.html
Alert: no method was found to stop the anbox emulator
func XMLtoCoords ¶
XMLtoCoords converts XML block coords to center tap coords. Accepts [x1,y1][x2,y2] format as string and returns [2]int coords
Types ¶
type Device ¶
type Device struct {
ID string
Log bool
DefaultSleep int
Screen struct {
Width int
Height int
}
// contains filtered or unexported fields
}
Device main structure
func (*Device) Activities ¶
Activities returns all package's activities
func (*Device) AutoRotate ¶
AutoRotate enables or disables the device auto rotation behaviour
func (*Device) DefaultBrowser ¶
DefaultBrowser loads the page in a default browser's new tab
func (*Device) DeviceReady ¶
DeviceReady returns the readiness state of the device
func (*Device) Exp2Tap ¶
Exp2Tap taps the screen in the coordinates fetched using a regular expression and the screen's xml dump
func (*Device) Foreground ¶
Foreground verifies if the given package is on foreground
func (*Device) HasInScreen ¶
HasInScreen verifies if the wanted text appear on screen
func (*Device) InstalledApp ¶
InstalledApp checks if the given app package is installed
func (*Device) IsScreenON ¶
IsScreenON verifies if the is on
func (*Device) PageDown ¶
func (device *Device) PageDown()
PageDown scrolls down a fixed amount of pixels
func (*Device) PowerButton ¶
func (device *Device) PowerButton()
PowerButton emulates the pressing of the power button
func (*Device) Root ¶
Root enables all adb commands to be run as root. Only works in rooted devices or emulators
func (*Device) ScreenRecord ¶
ScreenRecord records the screen as video with limited duration. Uses mp4 format
func (*Device) ScreenSize ¶
ScreenSize fetches the physical screen size and return its height and width
func (*Device) ScreenTimeout ¶
ScreenTimeout sets the screen off timeout to key1 seconds
Returns a function to be deferred setting timeout to key2 seconds ¶
Accepts only the following time intervals:
15s
30s
1m
2m
5m
10m
30m
func (*Device) Shell ¶
Shell executes the given command in the Linux bash terminal and return the command output as string
func (*Device) StartApp ¶
StartApp requires the package name with format com.packagename and activity such as com.packagename.MainActivity
func (*Device) TapCleanInput ¶
TapCleanInput tap and cleans the input
func (*Device) TapScreen ¶
TapScreen taps the given coords and waits the given delay in Milliseconds
func (*Device) WaitApp ¶
WaitApp waits until the given app appears on the foreground.
Waits for given miliseconds after each try.
Note: Has limited retry count
func (*Device) WaitDeviceReady ¶
WaitDeviceReady waits until the device. It's specially useful after a fresh boot.
func (*Device) WaitInScreen ¶
WaitInScreen waits until the wanted text appear on screen. It requires a max retry count to avoid endless loop.