Documentation
¶
Overview ¶
Package device finds the Android devices and iOS simulators this machine can drive.
Index ¶
- Variables
- func ADB() string
- func AppInstalled(ctx context.Context, d Info, appID string) bool
- func IsURL(s string) bool
- type ADBDevice
- func (a *ADBDevice) ExistingForward(ctx context.Context, remote string) int
- func (a *ADBDevice) Forward(ctx context.Context, remote string) (int, error)
- func (a *ADBDevice) Run(ctx context.Context, args ...string) (string, error)
- func (a *ADBDevice) Shell(ctx context.Context, script string) (string, error)
- type Info
- type Platform
Constants ¶
This section is empty.
Variables ¶
var WebAvailable = func() bool { return false }
WebAvailable reports whether a browser for web flows exists (set by the web driver).
Functions ¶
func ADB ¶
func ADB() string
ADB returns the path to adb, preferring ANDROID_HOME and the default SDK location.
func AppInstalled ¶
AppInstalled reports whether the app (package or bundle id) is installed on the device. It answers true when it cannot tell, so a failed check never hides a device.
Types ¶
type ADBDevice ¶
type ADBDevice struct {
Serial string
// contains filtered or unexported fields
}
ADBDevice runs adb commands against one device.
func (*ADBDevice) ExistingForward ¶
ExistingForward returns the local port already forwarded to remote, or 0.
func (*ADBDevice) Forward ¶
Forward forwards a free local TCP port to a device socket ("localabstract:name" or "tcp:N") and returns the local port.
type Info ¶
type Info struct {
Platform Platform `json:"platform"`
Serial string `json:"serial"` // adb serial or simulator UDID
Name string `json:"name"`
Model string `json:"model,omitempty"`
Emulator bool `json:"emulator"`
State string `json:"state"`
}
Info describes one device that is connected and ready (an Android device in the "device" state, or a booted iOS simulator).
func List ¶
List returns every ready device, Android first, then iOS. Errors from one platform's tooling (adb missing, not on macOS) are ignored so the other still works.
func Pick ¶
Pick chooses a device. want may be empty, a serial/UDID, or a device name (case-insensitive). platform may be empty to allow either.