Documentation ¶
Index ¶
- Constants
- Variables
- func GetAndroidDevices(serial ...string) (devices []*gadb.Device, err error)
- func GetIOSDevices(udid ...string) (devices []gidevice.Device, err error)
- func NewAdbDriver() *adbDriver
- func NewUIADriver(capabilities Capabilities, urlPrefix string) (driver *uiaDriver, err error)
- type APIResponseImage
- type AbsScope
- type Action
- type ActionMethod
- type ActionOption
- func WithAbsScope(x1, y1, x2, y2 int) ActionOption
- func WithCustomDirection(sx, sy, ex, ey float64) ActionOption
- func WithCustomOption(key string, value interface{}) ActionOption
- func WithDirection(direction string) ActionOption
- func WithFrequency(frequency int) ActionOption
- func WithIdentifier(identifier string) ActionOption
- func WithIgnoreNotFoundError(ignoreError bool) ActionOption
- func WithIndex(index int) ActionOption
- func WithInterval(sec float64) ActionOption
- func WithMatchOne(matchOne bool) ActionOption
- func WithMaxRetryTimes(maxRetryTimes int) ActionOption
- func WithOffset(offsetX, offsetY int) ActionOption
- func WithPressDuration(duration float64) ActionOption
- func WithRegex(regex bool) ActionOption
- func WithScope(x1, y1, x2, y2 float64) ActionOption
- func WithScreenShotClosePopups(closeOn bool) ActionOption
- func WithScreenShotLiveType(liveTypeOn bool) ActionOption
- func WithScreenShotOCR(ocrOn bool) ActionOption
- func WithScreenShotUITypes(uiTypes ...string) ActionOption
- func WithScreenShotUpload(uploadOn bool) ActionOption
- func WithSteps(steps int) ActionOption
- func WithTimeout(timeout int) ActionOption
- type ActionOptions
- type AdbLogcat
- type AlertAction
- type AndroidDevice
- func (dev *AndroidDevice) LogEnabled() bool
- func (dev *AndroidDevice) NewAdbDriver() (driver WebDriver, err error)
- func (dev *AndroidDevice) NewDriver(options ...DriverOption) (driverExt *DriverExt, err error)
- func (dev *AndroidDevice) NewHTTPDriver(capabilities Capabilities) (driver WebDriver, err error)
- func (dev *AndroidDevice) NewUSBDriver(capabilities Capabilities) (driver WebDriver, err error)
- func (dev *AndroidDevice) StartPcap() error
- func (dev *AndroidDevice) StartPerf() error
- func (dev *AndroidDevice) StopPcap() string
- func (dev *AndroidDevice) StopPerf() string
- func (dev *AndroidDevice) UUID() string
- type AndroidDeviceOption
- func GetAndroidDeviceOptions(dev *AndroidDevice) (deviceOptions []AndroidDeviceOption)
- func WithAdbLogOn(logOn bool) AndroidDeviceOption
- func WithSerialNumber(serial string) AndroidDeviceOption
- func WithUIA2(uia2On bool) AndroidDeviceOption
- func WithUIA2IP(ip string) AndroidDeviceOption
- func WithUIA2Port(port int) AndroidDeviceOption
- type AppBaseInfo
- type AppInfo
- type AppState
- type BatteryInfo
- type BatteryState
- type BatteryStatus
- type Box
- type CVArgs
- type CVOption
- type Capabilities
- func (caps Capabilities) WithDefaultAlertAction(alertAction AlertAction) Capabilities
- func (caps Capabilities) WithDisableAutomaticScreenshots(b bool) Capabilities
- func (caps Capabilities) WithElementResponseAttributes(s string) Capabilities
- func (caps Capabilities) WithEventloopIdleDelaySec(second float64) Capabilities
- func (caps Capabilities) WithMaxTypingFrequency(n int) Capabilities
- func (caps Capabilities) WithShouldTerminateApp(b bool) Capabilities
- func (caps Capabilities) WithShouldUseCompactResponses(b bool) Capabilities
- func (caps Capabilities) WithShouldUseSingletonTestManager(b bool) Capabilities
- func (caps Capabilities) WithShouldUseTestManagerForVisibilityDetection(b bool) Capabilities
- func (caps Capabilities) WithWaitForIdleTimeout(second float64) Capabilities
- type ClosePopupsResult
- type Condition
- type Device
- type DeviceButton
- type DeviceInfo
- type DeviceStatus
- type Direction
- type Driver
- type DriverExt
- func (dExt *DriverExt) AssertForegroundApp(appName, assert string) bool
- func (dExt *DriverExt) AssertImage(imagePath, assert string) bool
- func (dExt *DriverExt) AssertOCR(text, assert string) bool
- func (dExt *DriverExt) AutoPopupHandler() error
- func (dExt *DriverExt) CloseMjpegStream()
- func (dExt *DriverExt) ClosePopups(options ...ActionOption) error
- func (dExt *DriverExt) ClosePopupsHandler(options ...ActionOption) error
- func (dExt *DriverExt) ConnectMjpegStream(httpClient *http.Client) (err error)
- func (dExt *DriverExt) DoAction(action MobileAction) (err error)
- func (dExt *DriverExt) DoValidation(check, assert, expected string, message ...string) bool
- func (dExt *DriverExt) DoubleTap(param string) (err error)
- func (dExt *DriverExt) DoubleTapOffset(param string, xOffset, yOffset float64) (err error)
- func (dExt *DriverExt) DoubleTapXY(x, y float64) error
- func (dExt *DriverExt) Drag(pathname string, toX, toY int, pressForDuration ...float64) (err error)
- func (dExt *DriverExt) DragFloat(pathname string, toX, toY float64, pressForDuration ...float64) (err error)
- func (dExt *DriverExt) DragOffset(pathname string, toX, toY int, xOffset, yOffset float64, ...) (err error)
- func (dExt *DriverExt) DragOffsetFloat(pathname string, toX, toY, xOffset, yOffset float64, ...) (err error)
- func (dExt *DriverExt) FindAllImageRect(search string) (rects []image.Rectangle, err error)
- func (dExt *DriverExt) FindImageRectInUIKit(imagePath string, options ...ActionOption) (point PointF, err error)
- func (dExt *DriverExt) FindScreenText(text string, options ...ActionOption) (point PointF, err error)
- func (dExt *DriverExt) FindUIRectInUIKit(search string, options ...ActionOption) (point PointF, err error)
- func (dExt *DriverExt) FindUIResult(options ...ActionOption) (point PointF, err error)
- func (dExt *DriverExt) GenAbsScope(x1, y1, x2, y2 float64) AbsScope
- func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *ScreenResult, err error)
- func (dExt *DriverExt) GetScreenTexts() (ocrTexts OCRTexts, err error)
- func (dExt *DriverExt) GetStepCacheData() map[string]interface{}
- func (dExt *DriverExt) Input(text string) (err error)
- func (dExt *DriverExt) LoopUntil(findAction, findCondition, foundAction Action, options ...ActionOption) error
- func (dExt *DriverExt) ParseActionOptions(options ...ActionOption) []ActionOption
- func (dExt *DriverExt) SwipeDown(options ...ActionOption) (err error)
- func (dExt *DriverExt) SwipeLeft(options ...ActionOption) (err error)
- func (dExt *DriverExt) SwipeRelative(fromX, fromY, toX, toY float64, options ...ActionOption) error
- func (dExt *DriverExt) SwipeRight(options ...ActionOption) (err error)
- func (dExt *DriverExt) SwipeTo(direction string, options ...ActionOption) (err error)
- func (dExt *DriverExt) SwipeUp(options ...ActionOption) (err error)
- func (dExt *DriverExt) Tap(param string, options ...ActionOption) error
- func (dExt *DriverExt) TapAbsXY(x, y float64, options ...ActionOption) error
- func (dExt *DriverExt) TapByCV(imagePath string, options ...ActionOption) error
- func (dExt *DriverExt) TapByOCR(ocrText string, options ...ActionOption) error
- func (dExt *DriverExt) TapByUIDetection(options ...ActionOption) error
- func (dExt *DriverExt) TapOffset(param string, xOffset, yOffset float64, options ...ActionOption) (err error)
- func (dExt *DriverExt) TapXY(x, y float64, options ...ActionOption) error
- func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error)
- type DriverOption
- type DriverOptions
- type EventPageID
- type EventUsageID
- type ExportPoint
- type FeedConfig
- type FeedVideo
- type ForegroundApp
- type IImageService
- type IOSDevice
- func (dev *IOSDevice) LogEnabled() bool
- func (dev *IOSDevice) NewDriver(options ...DriverOption) (driverExt *DriverExt, err error)
- func (dev *IOSDevice) NewHTTPDriver(capabilities Capabilities) (driver WebDriver, err error)
- func (dev *IOSDevice) NewUSBDriver(capabilities Capabilities) (driver WebDriver, err error)
- func (dev *IOSDevice) RunXCTest(bundleID string) (cancel context.CancelFunc, err error)
- func (dev *IOSDevice) StartPcap() error
- func (dev *IOSDevice) StartPerf() error
- func (dev *IOSDevice) StopPcap() string
- func (dev *IOSDevice) StopPerf() string
- func (dev *IOSDevice) UUID() string
- type IOSDeviceOption
- func GetIOSDeviceOptions(dev *IOSDevice) (deviceOptions []IOSDeviceOption)
- func WithAcceptAlertButtonSelector(selector string) IOSDeviceOption
- func WithDismissAlertButtonSelector(selector string) IOSDeviceOption
- func WithIOSPcapOptions(options ...gidevice.PcapOption) IOSDeviceOption
- func WithIOSPerfOptions(options ...gidevice.PerfOption) IOSDeviceOption
- func WithResetHomeOnStartup(reset bool) IOSDeviceOption
- func WithSnapshotMaxDepth(depth int) IOSDeviceOption
- func WithUDID(udid string) IOSDeviceOption
- func WithWDALogOn(logOn bool) IOSDeviceOption
- func WithWDAMjpegPort(port int) IOSDeviceOption
- func WithWDAPort(port int) IOSDeviceOption
- func WithXCTest(bundleID string) IOSDeviceOption
- type IOSPcapOption
- type IOSPerfOption
- type ImageResult
- type KeyCode
- type KeyFlag
- type KeyMeta
- type LiveConfig
- type LiveRoom
- type Location
- type MobileAction
- type NotificationType
- type OCRResult
- type OCRResults
- type OCRText
- type OCRTexts
- type Orientation
- type PasteboardType
- type PickerWheelOrder
- type Point
- type PointF
- type PopupInfo
- type Rect
- type Rotation
- type Scope
- type Screen
- type ScreenResult
- type ScreenResultMap
- type SessionInfo
- type Size
- type SourceOption
- func (opt SourceOption) WithExcludedAttributes(attributes []string) SourceOption
- func (opt SourceOption) WithFormatAsDescription() SourceOption
- func (opt SourceOption) WithFormatAsJson() SourceOption
- func (opt SourceOption) WithFormatAsXml() SourceOption
- func (opt SourceOption) WithScope(scope string) SourceOption
- type TargetLabel
- type TemplateMatchMode
- type UIResult
- type UIResultMap
- type UIResults
- type UiSelectorHelper
- func (s UiSelectorHelper) Checkable(b bool) UiSelectorHelper
- func (s UiSelectorHelper) Checked(b bool) UiSelectorHelper
- func (s UiSelectorHelper) ChildSelector(selector UiSelectorHelper) UiSelectorHelper
- func (s UiSelectorHelper) ClassName(className string) UiSelectorHelper
- func (s UiSelectorHelper) ClassNameMatches(regex string) UiSelectorHelper
- func (s UiSelectorHelper) Clickable(b bool) UiSelectorHelper
- func (s UiSelectorHelper) ContainerSelector(selector UiSelectorHelper) UiSelectorHelper
- func (s UiSelectorHelper) Description(desc string) UiSelectorHelper
- func (s UiSelectorHelper) DescriptionContains(desc string) UiSelectorHelper
- func (s UiSelectorHelper) DescriptionMatches(regex string) UiSelectorHelper
- func (s UiSelectorHelper) DescriptionStartsWith(desc string) UiSelectorHelper
- func (s UiSelectorHelper) Enabled(b bool) UiSelectorHelper
- func (s UiSelectorHelper) Focusable(b bool) UiSelectorHelper
- func (s UiSelectorHelper) Focused(b bool) UiSelectorHelper
- func (s UiSelectorHelper) FromParent(selector UiSelectorHelper) UiSelectorHelper
- func (s UiSelectorHelper) Index(index int) UiSelectorHelper
- func (s UiSelectorHelper) Instance(instance int) UiSelectorHelper
- func (s UiSelectorHelper) LongClickable(b bool) UiSelectorHelper
- func (s UiSelectorHelper) PackageNameMatches(regex string) UiSelectorHelper
- func (s UiSelectorHelper) PatternSelector(selector UiSelectorHelper) UiSelectorHelper
- func (s UiSelectorHelper) ResourceId(id string) UiSelectorHelper
- func (s UiSelectorHelper) ResourceIdMatches(regex string) UiSelectorHelper
- func (s UiSelectorHelper) Scrollable(b bool) UiSelectorHelper
- func (s UiSelectorHelper) Selected(b bool) UiSelectorHelper
- func (s UiSelectorHelper) String() string
- func (s UiSelectorHelper) Text(text string) UiSelectorHelper
- func (s UiSelectorHelper) TextContains(text string) UiSelectorHelper
- func (s UiSelectorHelper) TextMatches(regex string) UiSelectorHelper
- func (s UiSelectorHelper) TextStartsWith(text string) UiSelectorHelper
- type VideoCrawler
- type VideoCrawlerConfigs
- type WebDriver
Constants ¶
const ( ACTION_AppInstall ActionMethod = "install" ACTION_AppUninstall ActionMethod = "uninstall" ACTION_AppStart ActionMethod = "app_start" ACTION_AppLaunch ActionMethod = "app_launch" // 启动 app 并堵塞等待 app 首屏加载完成 ACTION_AppTerminate ActionMethod = "app_terminate" ACTION_AppStop ActionMethod = "app_stop" ACTION_ScreenShot ActionMethod = "screenshot" ACTION_Sleep ActionMethod = "sleep" ACTION_SleepRandom ActionMethod = "sleep_random" ACTION_StartCamera ActionMethod = "camera_start" // alias for app_launch camera ACTION_StopCamera ActionMethod = "camera_stop" // alias for app_terminate camera // UI validation // selectors SelectorName string = "ui_name" SelectorLabel string = "ui_label" SelectorOCR string = "ui_ocr" SelectorImage string = "ui_image" SelectorForegroundApp string = "ui_foreground_app" // assertions AssertionEqual string = "equal" AssertionNotEqual string = "not_equal" AssertionExists string = "exists" AssertionNotExists string = "not_exists" // UI handling ACTION_Home ActionMethod = "home" ACTION_TapXY ActionMethod = "tap_xy" ACTION_TapAbsXY ActionMethod = "tap_abs_xy" ACTION_TapByOCR ActionMethod = "tap_ocr" ACTION_TapByCV ActionMethod = "tap_cv" ACTION_Tap ActionMethod = "tap" ACTION_DoubleTapXY ActionMethod = "double_tap_xy" ACTION_DoubleTap ActionMethod = "double_tap" ACTION_Swipe ActionMethod = "swipe" ACTION_Input ActionMethod = "input" ACTION_Back ActionMethod = "back" // custom actions ACTION_SwipeToTapApp ActionMethod = "swipe_to_tap_app" // swipe left & right to find app and tap ACTION_SwipeToTapText ActionMethod = "swipe_to_tap_text" // swipe up & down to find text and tap ACTION_SwipeToTapTexts ActionMethod = "swipe_to_tap_texts" // swipe up & down to find text and tap ACTION_VideoCrawler ActionMethod = "video_crawler" ACTION_ClosePopups ActionMethod = "close_popups" )
const ( TextBackspace string = "\u0008" TextDelete string = "\u007F" )
const ( CloseStatusFound = "found" CloseStatusSuccess = "success" CloseStatusFail = "fail" )
Variables ¶
var ( AdbServerHost = "localhost" AdbServerPort = gadb.AdbServerPort // 5037 UIA2ServerHost = "localhost" UIA2ServerPort = 6790 DeviceTempPath = "/data/local/tmp" )
var ( DefaultWaitTimeout = 60 * time.Second DefaultWaitInterval = 400 * time.Millisecond )
var ( WithIOSPerfSystemCPU = gidevice.WithPerfSystemCPU WithIOSPerfSystemMem = gidevice.WithPerfSystemMem WithIOSPerfSystemDisk = gidevice.WithPerfSystemDisk WithIOSPerfSystemNetwork = gidevice.WithPerfSystemNetwork WithIOSPerfGPU = gidevice.WithPerfGPU WithIOSPerfFPS = gidevice.WithPerfFPS WithIOSPerfNetwork = gidevice.WithPerfNetwork WithIOSPerfBundleID = gidevice.WithPerfBundleID WithIOSPerfPID = gidevice.WithPerfPID WithIOSPerfOutputInterval = gidevice.WithPerfOutputInterval WithIOSPerfProcessAttributes = gidevice.WithPerfProcessAttributes WithIOSPerfSystemAttributes = gidevice.WithPerfSystemAttributes )
var ( WithIOSPcapAll = gidevice.WithPcapAll WithIOSPcapPID = gidevice.WithPcapPID WithIOSPcapProcName = gidevice.WithPcapProcName WithIOSPcapBundleID = gidevice.WithPcapBundleID )
var WithWaitTime = WithInterval
set alias for compatibility
Functions ¶
func GetAndroidDevices ¶ added in v4.3.3
func GetIOSDevices ¶ added in v4.3.3
func NewAdbDriver ¶ added in v4.3.2
func NewAdbDriver() *adbDriver
func NewUIADriver ¶
func NewUIADriver(capabilities Capabilities, urlPrefix string) (driver *uiaDriver, err error)
Types ¶
type APIResponseImage ¶ added in v4.3.4
type APIResponseImage struct { Code int `json:"code"` Message string `json:"message"` Result ImageResult `json:"result"` }
type AbsScope ¶ added in v4.3.4
type AbsScope []int
[x1, y1, x2, y2] in absolute pixels
func (AbsScope) Option ¶ added in v4.3.4
func (s AbsScope) Option() ActionOption
type ActionMethod ¶ added in v4.3.4
type ActionMethod string
type ActionOption ¶
type ActionOption func(o *ActionOptions)
func WithAbsScope ¶ added in v4.3.4
func WithAbsScope(x1, y1, x2, y2 int) ActionOption
WithAbsScope inputs area of [(x1,y1), (x2,y2)] x1, y1, x2, y2 are all absolute position of the screen
func WithCustomDirection ¶
func WithCustomDirection(sx, sy, ex, ey float64) ActionOption
WithCustomDirection inputs sx, sy, ex, ey
func WithCustomOption ¶
func WithCustomOption(key string, value interface{}) ActionOption
func WithDirection ¶
func WithDirection(direction string) ActionOption
WithDirection inputs direction (up, down, left, right)
func WithFrequency ¶ added in v4.3.4
func WithFrequency(frequency int) ActionOption
func WithIdentifier ¶
func WithIdentifier(identifier string) ActionOption
func WithIgnoreNotFoundError ¶
func WithIgnoreNotFoundError(ignoreError bool) ActionOption
func WithIndex ¶
func WithIndex(index int) ActionOption
func WithInterval ¶ added in v4.3.4
func WithInterval(sec float64) ActionOption
func WithMatchOne ¶ added in v4.3.6
func WithMatchOne(matchOne bool) ActionOption
func WithMaxRetryTimes ¶
func WithMaxRetryTimes(maxRetryTimes int) ActionOption
func WithOffset ¶ added in v4.3.1
func WithOffset(offsetX, offsetY int) ActionOption
func WithPressDuration ¶ added in v4.3.4
func WithPressDuration(duration float64) ActionOption
func WithRegex ¶ added in v4.3.4
func WithRegex(regex bool) ActionOption
func WithScope ¶
func WithScope(x1, y1, x2, y2 float64) ActionOption
WithScope inputs area of [(x1,y1), (x2,y2)] x1, y1, x2, y2 are all in [0, 1], which means the relative position of the screen
func WithScreenShotClosePopups ¶ added in v4.3.6
func WithScreenShotClosePopups(closeOn bool) ActionOption
func WithScreenShotLiveType ¶ added in v4.3.6
func WithScreenShotLiveType(liveTypeOn bool) ActionOption
func WithScreenShotOCR ¶ added in v4.3.6
func WithScreenShotOCR(ocrOn bool) ActionOption
func WithScreenShotUITypes ¶ added in v4.3.6
func WithScreenShotUITypes(uiTypes ...string) ActionOption
func WithScreenShotUpload ¶ added in v4.3.6
func WithScreenShotUpload(uploadOn bool) ActionOption
func WithSteps ¶ added in v4.3.1
func WithSteps(steps int) ActionOption
func WithTimeout ¶
func WithTimeout(timeout int) ActionOption
type ActionOptions ¶ added in v4.3.4
type ActionOptions struct { // log Identifier string `json:"identifier,omitempty" yaml:"identifier,omitempty"` // used to identify the action in log // control related MaxRetryTimes int `json:"max_retry_times,omitempty" yaml:"max_retry_times,omitempty"` // max retry times IgnoreNotFoundError bool `json:"ignore_NotFoundError,omitempty" yaml:"ignore_NotFoundError,omitempty"` // ignore error if target element not found Interval float64 `json:"interval,omitempty" yaml:"interval,omitempty"` // interval between retries in seconds PressDuration float64 `json:"duration,omitempty" yaml:"duration,omitempty"` // used to set duration of ios swipe action Steps int `json:"steps,omitempty" yaml:"steps,omitempty"` // used to set steps of android swipe action Direction interface{} `json:"direction,omitempty" yaml:"direction,omitempty"` // used by swipe to tap text or app Timeout int `json:"timeout,omitempty" yaml:"timeout,omitempty"` // TODO: wait timeout in seconds for mobile action Frequency int `json:"frequency,omitempty" yaml:"frequency,omitempty"` // scope related Scope Scope `json:"scope,omitempty" yaml:"scope,omitempty"` AbsScope AbsScope `json:"abs_scope,omitempty" yaml:"abs_scope,omitempty"` Regex bool `json:"regex,omitempty" yaml:"regex,omitempty"` // use regex to match text Offset []int `json:"offset,omitempty" yaml:"offset,omitempty"` // used to tap offset of point Index int `json:"index,omitempty" yaml:"index,omitempty"` // index of the target element MatchOne bool `json:"match_one,omitempty" yaml:"match_one,omitempty"` // match one of the targets if existed // set custiom options such as textview, id, description Custom map[string]interface{} `json:"custom,omitempty" yaml:"custom,omitempty"` // screenshot related ScreenShotWithOCR bool `json:"screenshot_with_ocr,omitempty" yaml:"screenshot_with_ocr,omitempty"` ScreenShotWithUpload bool `json:"screenshot_with_upload,omitempty" yaml:"screenshot_with_upload,omitempty"` ScreenShotWithLiveType bool `json:"screenshot_with_live_type,omitempty" yaml:"screenshot_with_live_type,omitempty"` ScreenShotWithUITypes []string `json:"screenshot_with_ui_types,omitempty" yaml:"screenshot_with_ui_types,omitempty"` ScreenShotWithClosePopups bool `json:"screenshot_with_close_popups,omitempty" yaml:"screenshot_with_close_popups,omitempty"` }
func NewActionOptions ¶ added in v4.3.4
func NewActionOptions(options ...ActionOption) *ActionOptions
func (*ActionOptions) Options ¶ added in v4.3.4
func (o *ActionOptions) Options() []ActionOption
type AdbLogcat ¶ added in v4.3.1
type AdbLogcat struct {
// contains filtered or unexported fields
}
func NewAdbLogcat ¶
func (*AdbLogcat) BufferedLogcat ¶ added in v4.3.1
func (*AdbLogcat) CatchLogcat ¶ added in v4.3.1
func (*AdbLogcat) CatchLogcatContext ¶ added in v4.3.1
CatchLogcatContext starts logcat with timeout context
type AlertAction ¶
type AlertAction string
const ( AlertActionAccept AlertAction = "accept" AlertActionDismiss AlertAction = "dismiss" )
type AndroidDevice ¶
type AndroidDevice struct { SerialNumber string `json:"serial,omitempty" yaml:"serial,omitempty"` UIA2 bool `json:"uia2,omitempty" yaml:"uia2,omitempty"` // use uiautomator2 UIA2IP string `json:"uia2_ip,omitempty" yaml:"uia2_ip,omitempty"` // uiautomator2 server ip UIA2Port int `json:"uia2_port,omitempty" yaml:"uia2_port,omitempty"` // uiautomator2 server port LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"` // contains filtered or unexported fields }
func NewAndroidDevice ¶
func NewAndroidDevice(options ...AndroidDeviceOption) (device *AndroidDevice, err error)
uiautomator2 server must be started before adb shell am instrument -w io.appium.uiautomator2.server.test/androidx.test.runner.AndroidJUnitRunner
func (*AndroidDevice) LogEnabled ¶ added in v4.3.3
func (dev *AndroidDevice) LogEnabled() bool
func (*AndroidDevice) NewAdbDriver ¶ added in v4.3.2
func (dev *AndroidDevice) NewAdbDriver() (driver WebDriver, err error)
func (*AndroidDevice) NewDriver ¶
func (dev *AndroidDevice) NewDriver(options ...DriverOption) (driverExt *DriverExt, err error)
func (*AndroidDevice) NewHTTPDriver ¶
func (dev *AndroidDevice) NewHTTPDriver(capabilities Capabilities) (driver WebDriver, err error)
NewHTTPDriver creates new remote HTTP client, this will also start a new session.
func (*AndroidDevice) NewUSBDriver ¶
func (dev *AndroidDevice) NewUSBDriver(capabilities Capabilities) (driver WebDriver, err error)
NewUSBDriver creates new client via USB connected device, this will also start a new session.
func (*AndroidDevice) StartPcap ¶ added in v4.3.1
func (dev *AndroidDevice) StartPcap() error
func (*AndroidDevice) StartPerf ¶ added in v4.3.1
func (dev *AndroidDevice) StartPerf() error
func (*AndroidDevice) StopPcap ¶ added in v4.3.1
func (dev *AndroidDevice) StopPcap() string
func (*AndroidDevice) StopPerf ¶ added in v4.3.1
func (dev *AndroidDevice) StopPerf() string
func (*AndroidDevice) UUID ¶
func (dev *AndroidDevice) UUID() string
type AndroidDeviceOption ¶
type AndroidDeviceOption func(*AndroidDevice)
func GetAndroidDeviceOptions ¶
func GetAndroidDeviceOptions(dev *AndroidDevice) (deviceOptions []AndroidDeviceOption)
func WithAdbLogOn ¶
func WithAdbLogOn(logOn bool) AndroidDeviceOption
func WithSerialNumber ¶
func WithSerialNumber(serial string) AndroidDeviceOption
func WithUIA2 ¶ added in v4.3.2
func WithUIA2(uia2On bool) AndroidDeviceOption
func WithUIA2IP ¶ added in v4.3.2
func WithUIA2IP(ip string) AndroidDeviceOption
func WithUIA2Port ¶ added in v4.3.2
func WithUIA2Port(port int) AndroidDeviceOption
type AppBaseInfo ¶
type AppBaseInfo struct { Pid int `json:"pid,omitempty"` BundleId string `json:"bundleId,omitempty"` // ios package name ViewController string `json:"viewController,omitempty"` // ios view controller PackageName string `json:"packageName,omitempty"` // android package name Activity string `json:"activity,omitempty"` // android activity }
type AppInfo ¶
type AppInfo struct { ProcessArguments struct { Env interface{} `json:"env"` Args []interface{} `json:"args"` } `json:"processArguments"` Name string `json:"name"` AppBaseInfo }
type BatteryInfo ¶
type BatteryInfo struct { // Battery level in range [0.0, 1.0], where 1.0 means 100% charge. Level float64 `json:"level"` // Battery state ( 1: on battery, discharging; 2: plugged in, less than 100%, 3: plugged in, at 100% ) State BatteryState `json:"state"` Status BatteryStatus `json:"status"` }
type BatteryState ¶
type BatteryState int
const ( BatteryStateUnplugged BatteryState = iota // on battery, discharging BatteryStateCharging // plugged in, less than 100% BatteryStateFull // plugged in, at 100% )
func (BatteryState) String ¶
func (v BatteryState) String() string
type BatteryStatus ¶
type BatteryStatus int
const ( BatteryStatusUnknown BatteryStatus = iota BatteryStatusCharging BatteryStatusDischarging BatteryStatusNotCharging BatteryStatusFull )
func (BatteryStatus) String ¶
func (bs BatteryStatus) String() string
type Box ¶ added in v4.3.6
type Box struct { Point PointF `json:"point"` Width float64 `json:"width"` Height float64 `json:"height"` }
func (Box) IsIdentical ¶ added in v4.3.6
type CVOption ¶
type CVOption func(*CVArgs)
func WithTemplateMatchMode ¶
func WithTemplateMatchMode(mode TemplateMatchMode) CVOption
func WithThreshold ¶
type Capabilities ¶
type Capabilities map[string]interface{}
func NewCapabilities ¶
func NewCapabilities() Capabilities
func (Capabilities) WithDefaultAlertAction ¶
func (caps Capabilities) WithDefaultAlertAction(alertAction AlertAction) Capabilities
WithDefaultAlertAction
func (Capabilities) WithDisableAutomaticScreenshots ¶
func (caps Capabilities) WithDisableAutomaticScreenshots(b bool) Capabilities
WithDisableAutomaticScreenshots
Defaults to `true`
func (Capabilities) WithElementResponseAttributes ¶
func (caps Capabilities) WithElementResponseAttributes(s string) Capabilities
WithElementResponseAttributes If shouldUseCompactResponses == NO, is the comma-separated list of fields to return with each element.
Defaults to `type,label`.
func (Capabilities) WithEventloopIdleDelaySec ¶
func (caps Capabilities) WithEventloopIdleDelaySec(second float64) Capabilities
WithEventloopIdleDelaySec Delays the invocation of '-[XCUIApplicationProcess setEventLoopHasIdled:]' by the timer interval passed. which is skipped on setting it to zero.
func (Capabilities) WithMaxTypingFrequency ¶
func (caps Capabilities) WithMaxTypingFrequency(n int) Capabilities
WithMaxTypingFrequency
Defaults to `60`.
func (Capabilities) WithShouldTerminateApp ¶
func (caps Capabilities) WithShouldTerminateApp(b bool) Capabilities
WithShouldTerminateApp
Defaults to `true`
func (Capabilities) WithShouldUseCompactResponses ¶
func (caps Capabilities) WithShouldUseCompactResponses(b bool) Capabilities
WithShouldUseCompactResponses If set to YES will use compact (standards-compliant) & faster responses
Defaults to `true`
func (Capabilities) WithShouldUseSingletonTestManager ¶
func (caps Capabilities) WithShouldUseSingletonTestManager(b bool) Capabilities
WithShouldUseSingletonTestManager
Defaults to `true`
func (Capabilities) WithShouldUseTestManagerForVisibilityDetection ¶
func (caps Capabilities) WithShouldUseTestManagerForVisibilityDetection(b bool) Capabilities
WithShouldUseTestManagerForVisibilityDetection If set to YES will ask TestManagerDaemon for element visibility
Defaults to `false`
func (Capabilities) WithWaitForIdleTimeout ¶
func (caps Capabilities) WithWaitForIdleTimeout(second float64) Capabilities
WithWaitForIdleTimeout
Defaults to `10`
type ClosePopupsResult ¶ added in v4.3.6
type ClosePopupsResult struct { Type string `json:"type"` PopupArea Box `json:"popupArea"` CloseArea Box `json:"closeArea"` Text string `json:"text"` }
ClosePopupsResult represents the result of recognized popup to close
type Device ¶
type Device interface { UUID() string // ios udid or android serial LogEnabled() bool NewDriver(...DriverOption) (driverExt *DriverExt, err error) StartPerf() error StopPerf() string StartPcap() error StopPcap() string }
current implemeted device: IOSDevice, AndroidDevice
type DeviceButton ¶
type DeviceButton string
DeviceButton A physical button on an iOS device.
const ( DeviceButtonHome DeviceButton = "home" DeviceButtonVolumeUp DeviceButton = "volumeUp" DeviceButtonVolumeDown DeviceButton = "volumeDown" )
type DeviceInfo ¶
type DeviceInfo struct { TimeZone string `json:"timeZone"` CurrentLocale string `json:"currentLocale"` Model string `json:"model"` UUID string `json:"uuid"` UserInterfaceIdiom int `json:"userInterfaceIdiom"` UserInterfaceStyle string `json:"userInterfaceStyle"` Name string `json:"name"` IsSimulator bool `json:"isSimulator"` ThermalState int `json:"thermalState"` // ANDROID_ID A 64-bit number (as a hex string) that is uniquely generated when the user // first sets up the device and should remain constant for the lifetime of the user's device. The value // may change if a factory reset is performed on the device. AndroidID string `json:"androidId"` // Build.MANUFACTURER value Manufacturer string `json:"manufacturer"` // Build.BRAND value Brand string `json:"brand"` // Current running OS's API VERSION APIVersion string `json:"apiVersion"` // The current version string, for example "1.0" or "3.4b5" PlatformVersion string `json:"platformVersion"` // the name of the current celluar network carrier CarrierName string `json:"carrierName"` // the real size of the default display RealDisplaySize string `json:"realDisplaySize"` // The logical density of the display in Density Independent Pixel units. DisplayDensity int `json:"displayDensity"` // available networks Networks []networkInfo `json:"networks"` // current system locale Locale string `json:"locale"` Bluetooth struct { State string `json:"state"` } `json:"bluetooth"` }
type DeviceStatus ¶
type DeviceStatus struct { Message string `json:"message"` State string `json:"state"` OS struct { TestmanagerdVersion int `json:"testmanagerdVersion"` Name string `json:"name"` SdkVersion string `json:"sdkVersion"` Version string `json:"version"` } `json:"os"` IOS struct { IP string `json:"ip"` SimulatorVersion string `json:"simulatorVersion"` } `json:"ios"` Ready bool `json:"ready"` Build struct { Time string `json:"time"` ProductBundleIdentifier string `json:"productBundleIdentifier"` } `json:"build"` }
type DriverExt ¶
type DriverExt struct { CVArgs Device Device Driver WebDriver ImageService IImageService // used to extract image data // contains filtered or unexported fields }
func (*DriverExt) AssertForegroundApp ¶ added in v4.3.6
func (*DriverExt) AssertImage ¶ added in v4.3.6
func (*DriverExt) AutoPopupHandler ¶ added in v4.3.4
func (*DriverExt) CloseMjpegStream ¶
func (dExt *DriverExt) CloseMjpegStream()
func (*DriverExt) ClosePopups ¶ added in v4.3.6
func (dExt *DriverExt) ClosePopups(options ...ActionOption) error
func (*DriverExt) ClosePopupsHandler ¶ added in v4.3.6
func (dExt *DriverExt) ClosePopupsHandler(options ...ActionOption) error
func (*DriverExt) ConnectMjpegStream ¶
func (*DriverExt) DoAction ¶
func (dExt *DriverExt) DoAction(action MobileAction) (err error)
func (*DriverExt) DoValidation ¶
func (*DriverExt) DoubleTapOffset ¶
func (*DriverExt) DoubleTapXY ¶
func (*DriverExt) DragOffset ¶
func (*DriverExt) DragOffsetFloat ¶
func (*DriverExt) FindAllImageRect ¶
func (*DriverExt) FindImageRectInUIKit ¶
func (dExt *DriverExt) FindImageRectInUIKit(imagePath string, options ...ActionOption) (point PointF, err error)
func (*DriverExt) FindScreenText ¶ added in v4.3.4
func (dExt *DriverExt) FindScreenText(text string, options ...ActionOption) (point PointF, err error)
func (*DriverExt) FindUIRectInUIKit ¶
func (dExt *DriverExt) FindUIRectInUIKit(search string, options ...ActionOption) (point PointF, err error)
func (*DriverExt) FindUIResult ¶ added in v4.3.6
func (dExt *DriverExt) FindUIResult(options ...ActionOption) (point PointF, err error)
func (*DriverExt) GenAbsScope ¶ added in v4.3.4
func (*DriverExt) GetScreenResult ¶ added in v4.3.4
func (dExt *DriverExt) GetScreenResult(options ...ActionOption) (screenResult *ScreenResult, err error)
GetScreenResult takes a screenshot, returns the image recognization result
func (*DriverExt) GetScreenTexts ¶ added in v4.3.4
func (*DriverExt) GetStepCacheData ¶ added in v4.3.4
func (*DriverExt) LoopUntil ¶
func (dExt *DriverExt) LoopUntil(findAction, findCondition, foundAction Action, options ...ActionOption) error
func (*DriverExt) ParseActionOptions ¶ added in v4.3.4
func (dExt *DriverExt) ParseActionOptions(options ...ActionOption) []ActionOption
func (*DriverExt) SwipeDown ¶
func (dExt *DriverExt) SwipeDown(options ...ActionOption) (err error)
func (*DriverExt) SwipeLeft ¶
func (dExt *DriverExt) SwipeLeft(options ...ActionOption) (err error)
func (*DriverExt) SwipeRelative ¶
func (dExt *DriverExt) SwipeRelative(fromX, fromY, toX, toY float64, options ...ActionOption) error
SwipeRelative swipe from relative position [fromX, fromY] to relative position [toX, toY]
func (*DriverExt) SwipeRight ¶
func (dExt *DriverExt) SwipeRight(options ...ActionOption) (err error)
func (*DriverExt) SwipeTo ¶
func (dExt *DriverExt) SwipeTo(direction string, options ...ActionOption) (err error)
func (*DriverExt) SwipeUp ¶
func (dExt *DriverExt) SwipeUp(options ...ActionOption) (err error)
func (*DriverExt) TapAbsXY ¶
func (dExt *DriverExt) TapAbsXY(x, y float64, options ...ActionOption) error
func (*DriverExt) TapByCV ¶
func (dExt *DriverExt) TapByCV(imagePath string, options ...ActionOption) error
func (*DriverExt) TapByOCR ¶
func (dExt *DriverExt) TapByOCR(ocrText string, options ...ActionOption) error
func (*DriverExt) TapByUIDetection ¶ added in v4.3.6
func (dExt *DriverExt) TapByUIDetection(options ...ActionOption) error
func (*DriverExt) TapOffset ¶
func (dExt *DriverExt) TapOffset(param string, xOffset, yOffset float64, options ...ActionOption) (err error)
func (*DriverExt) VideoCrawler ¶ added in v4.3.4
func (dExt *DriverExt) VideoCrawler(configs *VideoCrawlerConfigs) (err error)
type DriverOption ¶ added in v4.3.6
type DriverOption func(*DriverOptions)
func WithDriverCapabilities ¶ added in v4.3.6
func WithDriverCapabilities(capabilities Capabilities) DriverOption
func WithDriverPlugin ¶ added in v4.3.6
func WithDriverPlugin(plugin funplugin.IPlugin) DriverOption
type DriverOptions ¶ added in v4.3.6
type DriverOptions struct {
// contains filtered or unexported fields
}
type EventPageID ¶
type EventPageID int
EventPageID The event page identifier
const EventPageIDConsumer EventPageID = 0x0C
type EventUsageID ¶
type EventUsageID int
EventUsageID The event usage identifier (usages are defined per-page)
const ( EventUsageIDCsmrVolumeUp EventUsageID = 0xE9 EventUsageIDCsmrVolumeDown EventUsageID = 0xEA EventUsageIDCsmrHome EventUsageID = 0x40 EventUsageIDCsmrPower EventUsageID = 0x30 EventUsageIDCsmrSnapshot EventUsageID = 0x65 // Power + Home )
type ExportPoint ¶
type ExportPoint struct { Start int `json:"start" yaml:"start"` End int `json:"end" yaml:"end"` From interface{} `json:"from" yaml:"from"` To interface{} `json:"to" yaml:"to"` Operation string `json:"operation" yaml:"operation"` Ext string `json:"ext" yaml:"ext"` RunTime int `json:"run_time,omitempty" yaml:"run_time,omitempty"` }
func ConvertPoints ¶
func ConvertPoints(data string) (eps []ExportPoint)
type FeedConfig ¶ added in v4.3.4
type FeedConfig struct { TargetCount int `json:"target_count"` TargetLabels []TargetLabel `json:"target_labels"` SleepRandom []interface{} `json:"sleep_random"` }
type FeedVideo ¶ added in v4.3.6
type FeedVideo struct { // 视频基础数据 VideoID string `json:"video_id"` // 视频 video ID UserName string `json:"user_name"` // 视频作者 Duration int64 `json:"duration"` // 视频时长(ms) Caption string `json:"caption"` // 视频文案 Type string `json:"type"` // 视频类型, feed/live // TODO: 区分视频、图文、广告 // 视频热度数据 ViewCount int64 `json:"view_count"` // feed 观看数 LikeCount int64 `json:"like_count"` // feed 点赞数 CommentCount int64 `json:"comment_count"` // feed 评论数 CollectCount int64 `json:"collect_count"` // feed 收藏数 ForwardCount int64 `json:"forward_count"` // feed 转发数 // 记录仿真决策信息 PlayDuration int64 `json:"play_duration"` // 播放时长(ms),取自 Simulation/Random SimulationPlayProgress float64 `json:"simulation_play_progress"` // 仿真播放比例(完播率) SimulationPlayDuration int64 `json:"simulation_play_duration"` // 仿真播放时长(ms) RandomPlayDuration int64 `json:"random_play_duration"` // 随机播放时长(ms) // timelines PublishTimestamp int64 `json:"publish_timestamp"` // feed 发布时间戳 PreloadTimestamp int64 `json:"preload_timestamp"` // feed 预加载时间戳 }
type ForegroundApp ¶ added in v4.3.4
type IImageService ¶ added in v4.3.4
type IImageService interface { // GetImage returns image result including ocr texts, uploaded image url, etc GetImage(imageBuf *bytes.Buffer, options ...ActionOption) (imageResult *ImageResult, err error) }
type IOSDevice ¶
type IOSDevice struct { PerfOptions *gidevice.PerfOptions `json:"perf_options,omitempty" yaml:"perf_options,omitempty"` PcapOptions *gidevice.PcapOptions `json:"pcap_options,omitempty" yaml:"pcap_options,omitempty"` UDID string `json:"udid,omitempty" yaml:"udid,omitempty"` Port int `json:"port,omitempty" yaml:"port,omitempty"` // WDA remote port MjpegPort int `json:"mjpeg_port,omitempty" yaml:"mjpeg_port,omitempty"` // WDA remote MJPEG port LogOn bool `json:"log_on,omitempty" yaml:"log_on,omitempty"` XCTestBundleID string `json:"xctest_bundle_id,omitempty" yaml:"xctest_bundle_id,omitempty"` // switch to iOS springboard before init WDA session ResetHomeOnStartup bool `json:"reset_home_on_startup,omitempty" yaml:"reset_home_on_startup,omitempty"` // config appium settings SnapshotMaxDepth int `json:"snapshot_max_depth,omitempty" yaml:"snapshot_max_depth,omitempty"` AcceptAlertButtonSelector string `json:"accept_alert_button_selector,omitempty" yaml:"accept_alert_button_selector,omitempty"` DismissAlertButtonSelector string `json:"dismiss_alert_button_selector,omitempty" yaml:"dismiss_alert_button_selector,omitempty"` // contains filtered or unexported fields }
func NewIOSDevice ¶
func NewIOSDevice(options ...IOSDeviceOption) (device *IOSDevice, err error)
func (*IOSDevice) LogEnabled ¶ added in v4.3.3
func (*IOSDevice) NewDriver ¶
func (dev *IOSDevice) NewDriver(options ...DriverOption) (driverExt *DriverExt, err error)
func (*IOSDevice) NewHTTPDriver ¶
func (dev *IOSDevice) NewHTTPDriver(capabilities Capabilities) (driver WebDriver, err error)
NewHTTPDriver creates new remote HTTP client, this will also start a new session.
func (*IOSDevice) NewUSBDriver ¶
func (dev *IOSDevice) NewUSBDriver(capabilities Capabilities) (driver WebDriver, err error)
NewUSBDriver creates new client via USB connected device, this will also start a new session.
func (*IOSDevice) RunXCTest ¶ added in v4.3.1
func (dev *IOSDevice) RunXCTest(bundleID string) (cancel context.CancelFunc, err error)
type IOSDeviceOption ¶
type IOSDeviceOption func(*IOSDevice)
func GetIOSDeviceOptions ¶
func GetIOSDeviceOptions(dev *IOSDevice) (deviceOptions []IOSDeviceOption)
func WithAcceptAlertButtonSelector ¶
func WithAcceptAlertButtonSelector(selector string) IOSDeviceOption
func WithDismissAlertButtonSelector ¶
func WithDismissAlertButtonSelector(selector string) IOSDeviceOption
func WithIOSPcapOptions ¶ added in v4.3.1
func WithIOSPcapOptions(options ...gidevice.PcapOption) IOSDeviceOption
func WithIOSPerfOptions ¶ added in v4.3.1
func WithIOSPerfOptions(options ...gidevice.PerfOption) IOSDeviceOption
func WithResetHomeOnStartup ¶
func WithResetHomeOnStartup(reset bool) IOSDeviceOption
func WithSnapshotMaxDepth ¶
func WithSnapshotMaxDepth(depth int) IOSDeviceOption
func WithUDID ¶
func WithUDID(udid string) IOSDeviceOption
func WithWDALogOn ¶ added in v4.3.1
func WithWDALogOn(logOn bool) IOSDeviceOption
func WithWDAMjpegPort ¶
func WithWDAMjpegPort(port int) IOSDeviceOption
func WithWDAPort ¶
func WithWDAPort(port int) IOSDeviceOption
func WithXCTest ¶ added in v4.3.1
func WithXCTest(bundleID string) IOSDeviceOption
type IOSPcapOption ¶ added in v4.3.1
type IOSPcapOption = gidevice.PcapOption
type IOSPerfOption ¶ added in v4.3.1
type IOSPerfOption = gidevice.PerfOption
type ImageResult ¶ added in v4.3.4
type ImageResult struct { URL string `json:"url"` // image uploaded url OCRResult OCRResults `json:"ocrResult"` // OCR texts // NoLive(非直播间) // Shop(电商) // LifeService(生活服务) // Show(秀场) // Game(游戏) // People(多人) // PK(PK) // Media(媒体) // Chat(语音) // Event(赛事) LiveType string `json:"liveType"` // 直播间类型 UIResult UIResultMap `json:"uiResult"` // 图标检测 CPResult ClosePopupsResult `json:"closeResult"` // 弹窗按钮检测 }
type KeyCode ¶
type KeyCode int
const ( // KCSoftLeft Soft Left key // Usually situated below the display on phones and used as a multi-function // feature key for selecting a software defined function shown on the bottom left // of the display. KCSoftLeft KeyCode = 1 // KCSoftRight Soft Right key. // Usually situated below the display on phones and used as a multi-function // feature key for selecting a software defined function shown on the bottom right // of the display. KCSoftRight KeyCode = 2 // KCHome Home key. // This key is handled by the framework and is never delivered to applications. KCHome KeyCode = 3 KCBack KeyCode = 4 // Back key KCCall KeyCode = 5 // Call key KCEndCall KeyCode = 6 // End Call key KC0 KeyCode = 7 // '0' key KC1 KeyCode = 8 // '1' key KC2 KeyCode = 9 // '2' key KC3 KeyCode = 10 // '3' key KC4 KeyCode = 11 // '4' key KC5 KeyCode = 12 // '5' key KC6 KeyCode = 13 // '6' key KC7 KeyCode = 14 // '7' key KC8 KeyCode = 15 // '8' key KC9 KeyCode = 16 // '9' key KCStar KeyCode = 17 // '*' key KCPound KeyCode = 18 // '#' key // KCDPadUp KeycodeDPadUp Directional Pad Up key. // May also be synthesized from trackball motions. KCDPadUp KeyCode = 19 // KCDPadDown Directional Pad Down key. // May also be synthesized from trackball motions. KCDPadDown KeyCode = 20 // KCDPadLeft Directional Pad Left key. // May also be synthesized from trackball motions. KCDPadLeft KeyCode = 21 // KCDPadRight Directional Pad Right key. // May also be synthesized from trackball motions. KCDPadRight KeyCode = 22 // KCDPadCenter Directional Pad Center key. // May also be synthesized from trackball motions. KCDPadCenter KeyCode = 23 // KCVolumeUp Volume Up key. // Adjusts the speaker volume up. KCVolumeUp KeyCode = 24 // KCVolumeDown Volume Down key. // Adjusts the speaker volume down. KCVolumeDown KeyCode = 25 // KCPower Power key. KCPower KeyCode = 26 // KCCamera Camera key. // Used to launch a camera application or take pictures. KCCamera KeyCode = 27 KCClear KeyCode = 28 // Clear key KCa KeyCode = 29 // 'a' key KCb KeyCode = 30 // 'b' key KCc KeyCode = 31 // 'c' key KCd KeyCode = 32 // 'd' key KCe KeyCode = 33 // 'e' key KCf KeyCode = 34 // 'f' key KCg KeyCode = 35 // 'g' key KCh KeyCode = 36 // 'h' key KCi KeyCode = 37 // 'i' key KCj KeyCode = 38 // 'j' key KCk KeyCode = 39 // 'k' key KCl KeyCode = 40 // 'l' key KCm KeyCode = 41 // 'm' key KCn KeyCode = 42 // 'n' key KCo KeyCode = 43 // 'o' key KCp KeyCode = 44 // 'p' key KCq KeyCode = 45 // 'q' key KCr KeyCode = 46 // 'r' key KCs KeyCode = 47 // 's' key KCt KeyCode = 48 // 't' key KCu KeyCode = 49 // 'u' key KCv KeyCode = 50 // 'v' key KCw KeyCode = 51 // 'w' key KCx KeyCode = 52 // 'x' key KCy KeyCode = 53 // 'y' key KCz KeyCode = 54 // 'z' key KCComma KeyCode = 55 // ',' key KCPeriod KeyCode = 56 // '.' key KCAltLeft KeyCode = 57 // Left Alt modifier key KCAltRight KeyCode = 58 // Right Alt modifier key KCShiftLeft KeyCode = 59 // Left Shift modifier key KCShiftRight KeyCode = 60 // Right Shift modifier key KCTab KeyCode = 61 // Tab key KCSpace KeyCode = 62 // Space key // KCSym Symbol modifier key. // Used to enter alternate symbols. KCSym KeyCode = 63 // KCExplorer Explorer special function key. // Used to launch a browser application. KCExplorer KeyCode = 64 // KCEnvelope Envelope special function key. // Used to launch a mail application. KCEnvelope KeyCode = 65 // KCEnter Enter key. KCEnter KeyCode = 66 // KCDel Backspace key. // Deletes characters before the insertion point, unlike `KCForwardDel`. KCDel KeyCode = 67 KCGrave KeyCode = 68 // '`' (backtick) key KCMinus KeyCode = 69 // '-' KCEquals KeyCode = 70 // '=' key KCLeftBracket KeyCode = 71 // '[' key KCRightBracket KeyCode = 72 // ']' key KCBackslash KeyCode = 73 // '\' key KCSemicolon KeyCode = 74 // ” key KCApostrophe KeyCode = 75 // ”' (apostrophe) key KCSlash KeyCode = 76 // '/' key KCAt KeyCode = 77 // '@' key // KCNum Number modifier key. // Used to enter numeric symbols. // This key is not Num Lock; it is more like `KCAltLeft` and is // interpreted as an ALT key by {@link android.text.method.MetaKeyKeyListener}. KCNum KeyCode = 78 // KCHeadsetHook Headset Hook key. // Used to hang up calls and stop media. KCHeadsetHook KeyCode = 79 // KCFocus Camera Focus key. // Used to focus the camera. // *Camera* focus KCFocus KeyCode = 80 KCPlus KeyCode = 81 // '+' key. KCMenu KeyCode = 82 // Menu key. KCNotification KeyCode = 83 // Notification key. KCSearch KeyCode = 84 // Search key. KCMediaPlayPause KeyCode = 85 // Play/Pause media key. KCMediaStop KeyCode = 86 // Stop media key. KCMediaNext KeyCode = 87 // Play Next media key. KCMediaPrevious KeyCode = 88 // Play Previous media key. KCMediaRewind KeyCode = 89 // Rewind media key. KCMediaFastForward KeyCode = 90 // Fast Forward media key. // KCMute Mute key. // Mutes the microphone, unlike `KCVolumeMute` KCMute KeyCode = 91 // KCPageUp Page Up key. KCPageUp KeyCode = 92 // KCPageDown Page Down key. KCPageDown KeyCode = 93 // KCPictSymbols Picture Symbols modifier key. // Used to switch symbol sets (Emoji, Kao-moji). // switch symbol-sets (Emoji,Kao-moji) KCPictSymbols KeyCode = 94 // KCSwitchCharset Switch Charset modifier key. // Used to switch character sets (Kanji, Katakana). // switch char-sets (Kanji,Katakana) KCSwitchCharset KeyCode = 95 // KCButtonA A Button key. // On a game controller, the A button should be either the button labeled A // or the first button on the bottom row of controller buttons. KCButtonA KeyCode = 96 // KCButtonB B Button key. // On a game controller, the B button should be either the button labeled B // or the second button on the bottom row of controller buttons. KCButtonB KeyCode = 97 // KCButtonC C Button key. // On a game controller, the C button should be either the button labeled C // or the third button on the bottom row of controller buttons. KCButtonC KeyCode = 98 // KCButtonX X Button key. // On a game controller, the X button should be either the button labeled X // or the first button on the upper row of controller buttons. KCButtonX KeyCode = 99 // KCButtonY Y Button key. // On a game controller, the Y button should be either the button labeled Y // or the second button on the upper row of controller buttons. KCButtonY KeyCode = 100 // KCButtonZ Z Button key. // On a game controller, the Z button should be either the button labeled Z // or the third button on the upper row of controller buttons. KCButtonZ KeyCode = 101 // KCButtonL1 L1 Button key. // On a game controller, the L1 button should be either the button labeled L1 (or L) // or the top left trigger button. KCButtonL1 KeyCode = 102 // KCButtonR1 R1 Button key. // On a game controller, the R1 button should be either the button labeled R1 (or R) // or the top right trigger button. KCButtonR1 KeyCode = 103 // KCButtonL2 L2 Button key. // On a game controller, the L2 button should be either the button labeled L2 // or the bottom left trigger button. KCButtonL2 KeyCode = 104 // KCButtonR2 R2 Button key. // On a game controller, the R2 button should be either the button labeled R2 // or the bottom right trigger button. KCButtonR2 KeyCode = 105 // KCButtonTHUMBL Left Thumb Button key. // On a game controller, the left thumb button indicates that the left (or only) // joystick is pressed. KCButtonTHUMBL KeyCode = 106 // KCButtonTHUMBR Right Thumb Button key. // On a game controller, the right thumb button indicates that the right // joystick is pressed. KCButtonTHUMBR KeyCode = 107 // KCButtonStart Start Button key. // On a game controller, the button labeled Start. KCButtonStart KeyCode = 108 // KCButtonSelect Select Button key. // On a game controller, the button labeled Select. KCButtonSelect KeyCode = 109 // KCButtonMode Mode Button key. // On a game controller, the button labeled Mode. KCButtonMode KeyCode = 110 // KCEscape Escape key. KCEscape KeyCode = 111 // KCForwardDel Forward Delete key. // Deletes characters ahead of the insertion point, unlike `KCDel`. KCForwardDel KeyCode = 112 KCCtrlLeft KeyCode = 113 // Left Control modifier key KCCtrlRight KeyCode = 114 // Right Control modifier key KCCapsLock KeyCode = 115 // Caps Lock key KCScrollLock KeyCode = 116 // Scroll Lock key KCMetaLeft KeyCode = 117 // Left Meta modifier key KCMetaRight KeyCode = 118 // Right Meta modifier key KCFunction KeyCode = 119 // Function modifier key KCSysRq KeyCode = 120 // System Request / Print Screen key KCBreak KeyCode = 121 // Break / Pause key // KCMoveHome Home Movement key. // Used for scrolling or moving the cursor around to the start of a line // or to the top of a list. KCMoveHome KeyCode = 122 // KCMoveEnd End Movement key. // Used for scrolling or moving the cursor around to the end of a line // or to the bottom of a list. KCMoveEnd KeyCode = 123 // KCInsert Insert key. // Toggles insert / overwrite edit mode. KCInsert KeyCode = 124 // KCForward Forward key. // Navigates forward in the history stack. Complement of `KCBack`. KCForward KeyCode = 125 // KCMediaPlay Play media key. KCMediaPlay KeyCode = 126 // KCMediaPause Pause media key. KCMediaPause KeyCode = 127 // KCMediaClose Close media key. // May be used to close a CD tray, for example. KCMediaClose KeyCode = 128 // KCMediaEject Eject media key. // May be used to eject a CD tray, for example. KCMediaEject KeyCode = 129 // KCMediaRecord Record media key. KCMediaRecord KeyCode = 130 KCF1 KeyCode = 131 // F1 key. KCF2 KeyCode = 132 // F2 key. KCF3 KeyCode = 133 // F3 key. KCF4 KeyCode = 134 // F4 key. KCF5 KeyCode = 135 // F5 key. KCF6 KeyCode = 136 // F6 key. KCF7 KeyCode = 137 // F7 key. KCF8 KeyCode = 138 // F8 key. KCF9 KeyCode = 139 // F9 key. KCF10 KeyCode = 140 // F10 key. KCF11 KeyCode = 141 // F11 key. KCF12 KeyCode = 142 // F12 key. // KCNumLock Num Lock key. // This is the Num Lock key; it is different from `KCNum`. // This key alters the behavior of other keys on the numeric keypad. KCNumLock KeyCode = 143 KCNumpad0 KeyCode = 144 // Numeric keypad '0' key KCNumpad1 KeyCode = 145 // Numeric keypad '1' key KCNumpad2 KeyCode = 146 // Numeric keypad '2' key KCNumpad3 KeyCode = 147 // Numeric keypad '3' key KCNumpad4 KeyCode = 148 // Numeric keypad '4' key KCNumpad5 KeyCode = 149 // Numeric keypad '5' key KCNumpad6 KeyCode = 150 // Numeric keypad '6' key KCNumpad7 KeyCode = 151 // Numeric keypad '7' key KCNumpad8 KeyCode = 152 // Numeric keypad '8' key KCNumpad9 KeyCode = 153 // Numeric keypad '9' key KCNumpadDivide KeyCode = 154 // Numeric keypad '/' key (for division) KCNumpadMultiply KeyCode = 155 // Numeric keypad '*' key (for multiplication) KCNumpadSubtract KeyCode = 156 // Numeric keypad '-' key (for subtraction) KCNumpadAdd KeyCode = 157 // Numeric keypad '+' key (for addition) KCNumpadDot KeyCode = 158 // Numeric keypad '.' key (for decimals or digit grouping) KCNumpadComma KeyCode = 159 // Numeric keypad ',' key (for decimals or digit grouping) KCNumpadEnter KeyCode = 160 // Numeric keypad Enter key KCNumpadEquals KeyCode = 161 // Numeric keypad 'KeyCode =' key KCNumpadLeftParen KeyCode = 162 // Numeric keypad '(' key KCNumpadRightParen KeyCode = 163 // Numeric keypad ')' key // KCVolumeMute Volume Mute key. // Mutes the speaker, unlike `KCMute`. // This key should normally be implemented as a toggle such that the first press // mutes the speaker and the second press restores the original volume. KCVolumeMute KeyCode = 164 // KCInfo Info key. // Common on TV remotes to show additional information related to what is // currently being viewed. KCInfo KeyCode = 165 // KCChannelUp Channel up key. // On TV remotes, increments the television channel. KCChannelUp KeyCode = 166 // KCChannelDown Channel down key. // On TV remotes, decrements the television channel. KCChannelDown KeyCode = 167 // KCZoomIn Zoom in key. KCZoomIn KeyCode = 168 // KCZoomOut Zoom out key. KCZoomOut KeyCode = 169 // KCTv TV key. // On TV remotes, switches to viewing live TV. KCTv KeyCode = 170 // KCWindow Window key. // On TV remotes, toggles picture-in-picture mode or other windowing functions. // On Android Wear devices, triggers a display offset. KCWindow KeyCode = 171 // KCGuide Guide key. // On TV remotes, shows a programming guide. KCGuide KeyCode = 172 // KCDvr DVR key. // On some TV remotes, switches to a DVR mode for recorded shows. KCDvr KeyCode = 173 // KCBookmark Bookmark key. // On some TV remotes, bookmarks content or web pages. KCBookmark KeyCode = 174 // KCCaptions Toggle captions key. // Switches the mode for closed-captioning text, for example during television shows. KCCaptions KeyCode = 175 // KCSettings Settings key. // Starts the system settings activity. KCSettings KeyCode = 176 // KCTvPower TV power key. // On TV remotes, toggles the power on a television screen. KCTvPower KeyCode = 177 // KCTvInput TV input key. // On TV remotes, switches the input on a television screen. KCTvInput KeyCode = 178 // KCStbPower Set-top-box power key. // On TV remotes, toggles the power on an external Set-top-box. KCStbPower KeyCode = 179 // KCStbInput Set-top-box input key. // On TV remotes, switches the input mode on an external Set-top-box. KCStbInput KeyCode = 180 // KCAvrPower A/V Receiver power key. // On TV remotes, toggles the power on an external A/V Receiver. KCAvrPower KeyCode = 181 // KCAvrInput A/V Receiver input key. // On TV remotes, switches the input mode on an external A/V Receiver. KCAvrInput KeyCode = 182 // KCProgRed Red "programmable" key. // On TV remotes, acts as a contextual/programmable key. KCProgRed KeyCode = 183 // KCProgGreen Green "programmable" key. // On TV remotes, actsas a contextual/programmable key. KCProgGreen KeyCode = 184 // KCProgYellow Yellow "programmable" key. // On TV remotes, acts as a contextual/programmable key. KCProgYellow KeyCode = 185 // KCProgBlue Blue "programmable" key. // On TV remotes, acts as a contextual/programmable key. KCProgBlue KeyCode = 186 // KCAppSwitch App switch key. // Should bring up the application switcher dialog. KCAppSwitch KeyCode = 187 KCButton1 KeyCode = 188 // Generic Game Pad Button #1 KCButton2 KeyCode = 189 // Generic Game Pad Button #2 KCButton3 KeyCode = 190 // Generic Game Pad Button #3 KCButton4 KeyCode = 191 // Generic Game Pad Button #4 KCButton5 KeyCode = 192 // Generic Game Pad Button #5 KCButton6 KeyCode = 193 // Generic Game Pad Button #6 KCButton7 KeyCode = 194 // Generic Game Pad Button #7 KCButton8 KeyCode = 195 // Generic Game Pad Button #8 KCButton9 KeyCode = 196 // Generic Game Pad Button #9 KCButton10 KeyCode = 197 // Generic Game Pad Button #10 KCButton11 KeyCode = 198 // Generic Game Pad Button #11 KCButton12 KeyCode = 199 // Generic Game Pad Button #12 KCButton13 KeyCode = 200 // Generic Game Pad Button #13 KCButton14 KeyCode = 201 // Generic Game Pad Button #14 KCButton15 KeyCode = 202 // Generic Game Pad Button #15 KCButton16 KeyCode = 203 // Generic Game Pad Button #16 // KCLanguageSwitch Language Switch key. // Toggles the current input language such as switching between English and Japanese on // a QWERTY keyboard. On some devices, the same function may be performed by // pressing Shift+Spacebar. KCLanguageSwitch KeyCode = 204 // Manner Mode key. // Toggles silent or vibrate mode on and off to make the device behave more politely // in certain settings such as on a crowded train. On some devices, the key may only // operate when long-pressed. KCMannerMode KeyCode = 205 // 3D Mode key. // Toggles the display between 2D and 3D mode. KC3dMode KeyCode = 206 // Contacts special function key. // Used to launch an address book application. KCContacts KeyCode = 207 // Calendar special function key. // Used to launch a calendar application. KCCalendar KeyCode = 208 // Music special function key. // Used to launch a music player application. KCMusic KeyCode = 209 // Calculator special function key. // Used to launch a calculator application. KCCalculator KeyCode = 210 // Japanese full-width / half-width key. KCZenkakuHankaku KeyCode = 211 // Japanese alphanumeric key. KCEisu KeyCode = 212 // Japanese non-conversion key. KCMuhenkan KeyCode = 213 // Japanese conversion key. KCHenkan KeyCode = 214 // Japanese katakana / hiragana key. KCKatakanaHiragana KeyCode = 215 // Japanese Yen key. KCYen KeyCode = 216 // Japanese Ro key. KCRo KeyCode = 217 // Japanese kana key. KCKana KeyCode = 218 // Assist key. // Launches the global assist activity. Not delivered to applications. KCAssist KeyCode = 219 // Brightness Down key. // Adjusts the screen brightness down. KCBrightnessDown KeyCode = 220 // Brightness Up key. // Adjusts the screen brightness up. KCBrightnessUp KeyCode = 221 // Audio Track key. // Switches the audio tracks. KCMediaAudioTrack KeyCode = 222 // Sleep key. // Puts the device to sleep. Behaves somewhat like {@link #KEYCODE_POWER} but it // has no effect if the device is already asleep. KCSleep KeyCode = 223 // Wakeup key. // Wakes up the device. Behaves somewhat like {@link #KEYCODE_POWER} but it // has no effect if the device is already awake. KCWakeup KeyCode = 224 // Pairing key. // Initiates peripheral pairing mode. Useful for pairing remote control // devices or game controllers, especially if no other input mode is // available. KCPairing KeyCode = 225 // Media Top Menu key. // Goes to the top of media menu. KCMediaTopMenu KeyCode = 226 // '11' key. KC11 KeyCode = 227 // '12' key. KC12 KeyCode = 228 // Last Channel key. // Goes to the last viewed channel. KCLastChannel KeyCode = 229 // TV data service key. // Displays data services like weather, sports. KCTvDataService KeyCode = 230 // Voice Assist key. // Launches the global voice assist activity. Not delivered to applications. KCVoiceAssist KeyCode = 231 // Radio key. // Toggles TV service / Radio service. KCTvRadioService KeyCode = 232 // Teletext key. // Displays Teletext service. KCTvTeletext KeyCode = 233 // Number entry key. // Initiates to enter multi-digit channel nubmber when each digit key is assigned // for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC // User Control Code. KCTvNumberEntry KeyCode = 234 // Analog Terrestrial key. // Switches to analog terrestrial broadcast service. KCTvTerrestrialAnalog KeyCode = 235 // Digital Terrestrial key. // Switches to digital terrestrial broadcast service. KCTvTerrestrialDigital KeyCode = 236 // Satellite key. // Switches to digital satellite broadcast service. KCTvSatellite KeyCode = 237 // BS key. // Switches to BS digital satellite broadcasting service available in Japan. KCTvSatelliteBs KeyCode = 238 // CS key. // Switches to CS digital satellite broadcasting service available in Japan. KCTvSatelliteCs KeyCode = 239 // BS/CS key. // Toggles between BS and CS digital satellite services. KCTvSatelliteService KeyCode = 240 // Toggle Network key. // Toggles selecting broacast services. KCTvNetwork KeyCode = 241 // Antenna/Cable key. // Toggles broadcast input source between antenna and cable. KCTvAntennaCable KeyCode = 242 // HDMI #1 key. // Switches to HDMI input #1. KCTvInputHdmi1 KeyCode = 243 // HDMI #2 key. // Switches to HDMI input #2. KCTvInputHdmi2 KeyCode = 244 // HDMI #3 key. // Switches to HDMI input #3. KCTvInputHdmi3 KeyCode = 245 // HDMI #4 key. // Switches to HDMI input #4. KCTvInputHdmi4 KeyCode = 246 // Composite #1 key. // Switches to composite video input #1. KCTvInputComposite1 KeyCode = 247 // Composite #2 key. // Switches to composite video input #2. KCTvInputComposite2 KeyCode = 248 // Component #1 key. // Switches to component video input #1. KCTvInputComponent1 KeyCode = 249 // Component #2 key. // Switches to component video input #2. KCTvInputComponent2 KeyCode = 250 // VGA #1 key. // Switches to VGA (analog RGB) input #1. KCTvInputVga1 KeyCode = 251 // Audio description key. // Toggles audio description off / on. KCTvAudioDescription KeyCode = 252 // Audio description mixing volume up key. // Louden audio description volume as compared with normal audio volume. KCTvAudioDescriptionMixUp KeyCode = 253 // Audio description mixing volume down key. // Lessen audio description volume as compared with normal audio volume. KCTvAudioDescriptionMixDown KeyCode = 254 // Zoom mode key. // Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.) KCTvZoomMode KeyCode = 255 // Contents menu key. // Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control // Code KCTvContentsMenu KeyCode = 256 // Media context menu key. // Goes to the context menu of media contents. Corresponds to Media Context-sensitive // Menu (0x11) of CEC User Control Code. KCTvMediaContextMenu KeyCode = 257 // Timer programming key. // Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of // CEC User Control Code. KCTvTimerProgramming KeyCode = 258 // Help key. KCHelp KeyCode = 259 // Goes backward by one item in an ordered collection of items. KCNavigatePrevious KeyCode = 260 // Advances to the next item in an ordered collection of items. KCNavigateNext KeyCode = 261 // Activates the item that currently has focus or expands to the next level of a navigation // hierarchy. KCNavigateIn KeyCode = 262 // Backs out one level of a navigation hierarchy or collapses the item that currently has // focus. KCNavigateOut KeyCode = 263 // Primary stem key for Wear // Main power/reset button on watch. KCStemPrimary KeyCode = 264 // Generic stem key 1 for Wear KCStem1 KeyCode = 265 // Generic stem key 2 for Wear KCStem2 KeyCode = 266 // Generic stem key 3 for Wear KCStem3 KeyCode = 267 // Directional Pad Up-Left KCDPadUpLeft KeyCode = 268 // Directional Pad Down-Left KCDPadDownLeft KeyCode = 269 // Directional Pad Up-Right KCDPadUpRight KeyCode = 270 // Directional Pad Down-Right KCDPadDownRight KeyCode = 271 // Skip forward media key. KCMediaSkipForward KeyCode = 272 // Skip backward media key. KCMediaSkipBackward KeyCode = 273 // Step forward media key. // Steps media forward, one frame at a time. KCMediaStepForward KeyCode = 274 // Step backward media key. // Steps media backward, one frame at a time. KCMediaStepBackward KeyCode = 275 // put device to sleep unless a wakelock is held. KCSoftSleep KeyCode = 276 // Cut key. KCCut KeyCode = 277 // Copy key. KCCopy KeyCode = 278 // Paste key. KCPaste KeyCode = 279 KCSystemNavigationUp KeyCode = 280 KCSystemNavigationDown KeyCode = 281 KCSystemNavigationLeft KeyCode = 282 KCSystemNavigationRight KeyCode = 283 // Show all apps KCAllApps KeyCode = 284 // Refresh key. KCRefresh KeyCode = 285 )
type KeyFlag ¶
type KeyFlag int
const ( // KFWokeHere This mask is set if the device woke because of this key event. // Deprecated KFWokeHere KeyFlag = 0x1 // KFSoftKeyboard This mask is set if the key event was generated by a software keyboard. KFSoftKeyboard KeyFlag = 0x2 // KFKeepTouchMode This mask is set if we don't want the key event to cause us to leave touch mode. KFKeepTouchMode KeyFlag = 0x4 // KFFromSystem This mask is set if an event was known to come from a trusted part // of the system. That is, the event is known to come from the user, // and could not have been spoofed by a third party component. KFFromSystem KeyFlag = 0x8 // KFEditorAction This mask is used for compatibility, to identify enter keys that are // coming from an IME whose enter key has been auto-labelled "next" or // "done". This allows TextView to dispatch these as normal enter keys // for old applications, but still do the appropriate action when receiving them. KFEditorAction KeyFlag = 0x10 // KFCanceled When associated with up key events, this indicates that the key press // has been canceled. Typically this is used with virtual touch screen // keys, where the user can slide from the virtual key area on to the // display: in that case, the application will receive a canceled up // event and should not perform the action normally associated with the // key. Note that for this to work, the application can not perform an // action for a key until it receives an up or the long press timeout has expired. KFCanceled KeyFlag = 0x20 // KFVirtualHardKey This key event was generated by a virtual (on-screen) hard key area. // Typically this is an area of the touchscreen, outside of the regular // display, dedicated to "hardware" buttons. KFVirtualHardKey KeyFlag = 0x40 // KFLongPress This flag is set for the first key repeat that occurs after the long press timeout. KFLongPress KeyFlag = 0x80 // KFCanceledLongPress Set when a key event has `KFCanceled` set because a long // press action was executed while it was down. KFCanceledLongPress KeyFlag = 0x100 // KFTracking Set for `ACTION_UP` when this event's key code is still being // tracked from its initial down. That is, somebody requested that tracking // started on the key down and a long press has not caused // the tracking to be canceled. KFTracking KeyFlag = 0x200 // KFFallback Set when a key event has been synthesized to implement default behavior // for an event that the application did not handle. // Fallback key events are generated by unhandled trackball motions // (to emulate a directional keypad) and by certain unhandled key presses // that are declared in the key map (such as special function numeric keypad // keys when numlock is off). KFFallback KeyFlag = 0x400 )
type LiveConfig ¶ added in v4.3.4
type LiveConfig struct { TargetCount int `json:"target_count"` TargetLabels []TargetLabel `json:"target_labels"` SleepRandom []interface{} `json:"sleep_random"` }
type LiveRoom ¶ added in v4.3.6
type LiveRoom struct { // 视频基础数据 LiveStreamID string `json:"live_stream_id"` // 直播流 ID UserName string `json:"user_name"` // 视频作者 Caption string `json:"caption"` // 视频文案 LiveType string `json:"live_type"` // 直播间类型, 基于算法服务获取 // 视频热度数据 AudienceCount string `json:"audience_count"` // 直播间人数 LikeCount int64 `json:"like_count"` // 点赞数 // 记录仿真决策信息 WatchDuration int64 `json:"watch_duration"` // 观播时长(ms),取自 Simulation/Random SimulationWatchDuration int64 `json:"simulation_watch_duration"` // 仿真观播时长(ms) RandomWatchDuration int64 `json:"random_watch_duration"` // 随机观播时长(ms) // timelines PreloadTimestamp int64 `json:"preload_timestamp"` // feed 预加载时间戳 }
type MobileAction ¶
type MobileAction struct { Method ActionMethod `json:"method,omitempty" yaml:"method,omitempty"` Params interface{} `json:"params,omitempty" yaml:"params,omitempty"` Options *ActionOptions `json:"options,omitempty" yaml:"options,omitempty"` ActionOptions }
func (MobileAction) GetOptions ¶ added in v4.3.6
func (ma MobileAction) GetOptions() []ActionOption
type NotificationType ¶
type NotificationType string
const ( NotificationTypePlain NotificationType = "plain" NotificationTypeDarwin NotificationType = "darwin" )
type OCRResults ¶ added in v4.3.4
type OCRResults []OCRResult
func (OCRResults) ToOCRTexts ¶ added in v4.3.4
func (o OCRResults) ToOCRTexts() (ocrTexts OCRTexts)
type OCRTexts ¶ added in v4.3.1
type OCRTexts []OCRText
func (OCRTexts) FilterScope ¶ added in v4.3.4
type Orientation ¶
type Orientation string
const ( // OrientationPortrait Device oriented vertically, home button on the bottom OrientationPortrait Orientation = "PORTRAIT" // OrientationPortraitUpsideDown Device oriented vertically, home button on the top OrientationPortraitUpsideDown Orientation = "UIA_DEVICE_ORIENTATION_PORTRAIT_UPSIDEDOWN" // OrientationLandscapeLeft Device oriented horizontally, home button on the right OrientationLandscapeLeft Orientation = "LANDSCAPE" // OrientationLandscapeRight Device oriented horizontally, home button on the left OrientationLandscapeRight Orientation = "UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT" )
type PasteboardType ¶
type PasteboardType string
PasteboardType The type of the item on the pasteboard.
const ( PasteboardTypePlaintext PasteboardType = "plaintext" PasteboardTypeImage PasteboardType = "image" PasteboardTypeUrl PasteboardType = "url" )
type PickerWheelOrder ¶
type PickerWheelOrder string
const ( PickerWheelOrderNext PickerWheelOrder = "next" PickerWheelOrderPrevious PickerWheelOrder = "previous" )
type PointF ¶
func (PointF) IsIdentical ¶ added in v4.3.6
type Scope ¶ added in v4.3.4
type Scope []float64
(x1, y1) is the top left corner, (x2, y2) is the bottom right corner [x1, y1, x2, y2] in percentage of the screen
type ScreenResult ¶ added in v4.3.4
type ScreenResult struct { UploadedURL string `json:"uploaded_url"` // uploaded image url Texts OCRTexts `json:"texts"` // dumped raw OCRTexts Icons UIResultMap `json:"icons"` // CV 识别的图标 Tags []string `json:"tags"` // tags for image, e.g. ["feed", "ad", "live"] VideoType string `json:"video_type,omitempty"` // video type: feed, live-preview or live Feed *FeedVideo `json:"feed,omitempty"` Live *LiveRoom `json:"live,omitempty"` Popup *PopupInfo `json:"popup,omitempty"` SwipeStartTime int64 `json:"swipe_start_time"` // 滑动开始时间戳 SwipeFinishTime int64 `json:"swipe_finish_time"` // 滑动结束时间戳 ScreenshotTakeElapsed int64 `json:"screenshot_take_elapsed"` // 设备截图耗时(ms) ScreenshotCVElapsed int64 `json:"screenshot_cv_elapsed"` // CV 识别耗时(ms) // 当前 Feed/Live 整体耗时 TotalElapsed int64 `json:"total_elapsed"` // current_swipe_finish -> next_swipe_start 整体耗时(ms) // contains filtered or unexported fields }
type ScreenResultMap ¶ added in v4.3.6
type ScreenResultMap map[string]*ScreenResult
type SessionInfo ¶
type SourceOption ¶
type SourceOption map[string]interface{}
SourceOption Configure the format or attribute of the Source
func NewSourceOption ¶
func NewSourceOption() SourceOption
func (SourceOption) WithExcludedAttributes ¶
func (opt SourceOption) WithExcludedAttributes(attributes []string) SourceOption
WithExcludedAttributes Excludes the given attribute names. only `xml` is supported.
func (SourceOption) WithFormatAsDescription ¶
func (opt SourceOption) WithFormatAsDescription() SourceOption
WithFormatAsDescription Application elements tree in form of internal XCTest debugDescription string
func (SourceOption) WithFormatAsJson ¶
func (opt SourceOption) WithFormatAsJson() SourceOption
WithFormatAsJson Application elements tree in form of json string
func (SourceOption) WithFormatAsXml ¶
func (opt SourceOption) WithFormatAsXml() SourceOption
WithFormatAsXml Application elements tree in form of xml string
func (SourceOption) WithScope ¶
func (opt SourceOption) WithScope(scope string) SourceOption
WithScope Allows to provide XML scope.
only `xml` is supported.
type TargetLabel ¶ added in v4.3.4
type TemplateMatchMode ¶
type TemplateMatchMode int
TemplateMatchMode is the type of the template matching operation.
type UIResultMap ¶ added in v4.3.6
func (UIResultMap) FilterUIResults ¶ added in v4.3.6
func (u UIResultMap) FilterUIResults(uiTypes []string) (uiResults UIResults, err error)
FilterUIResults filters ui icons, the former the uiTypes, the higher the priority
type UIResults ¶ added in v4.3.6
type UIResults []UIResult
func (UIResults) FilterScope ¶ added in v4.3.6
func (UIResults) GetUIResult ¶ added in v4.3.6
func (u UIResults) GetUIResult(options ...ActionOption) (UIResult, error)
type UiSelectorHelper ¶
type UiSelectorHelper struct {
// contains filtered or unexported fields
}
func NewUiSelectorHelper ¶
func NewUiSelectorHelper() UiSelectorHelper
func (UiSelectorHelper) Checkable ¶
func (s UiSelectorHelper) Checkable(b bool) UiSelectorHelper
Checkable Set the search criteria to match widgets that are checkable.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) Checked ¶
func (s UiSelectorHelper) Checked(b bool) UiSelectorHelper
Checked Set the search criteria to match widgets that are currently checked (usually for checkboxes).
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) ChildSelector ¶
func (s UiSelectorHelper) ChildSelector(selector UiSelectorHelper) UiSelectorHelper
ChildSelector Adds a child UiSelector criteria to this selector.
Use this selector to narrow the search scope to child widgets under a specific parent widget.
func (UiSelectorHelper) ClassName ¶
func (s UiSelectorHelper) ClassName(className string) UiSelectorHelper
ClassName Set the search criteria to match the class property for a widget (for example, "android.widget.Button").
func (UiSelectorHelper) ClassNameMatches ¶
func (s UiSelectorHelper) ClassNameMatches(regex string) UiSelectorHelper
ClassNameMatches Set the search criteria to match the class property for a widget, using a regular expression.
func (UiSelectorHelper) Clickable ¶
func (s UiSelectorHelper) Clickable(b bool) UiSelectorHelper
Clickable Set the search criteria to match widgets that are clickable.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) ContainerSelector ¶
func (s UiSelectorHelper) ContainerSelector(selector UiSelectorHelper) UiSelectorHelper
func (UiSelectorHelper) Description ¶
func (s UiSelectorHelper) Description(desc string) UiSelectorHelper
Description Set the search criteria to match the content-description property for a widget.
The content-description is typically used by the Android Accessibility framework to provide an audio prompt for the widget when the widget is selected. The content-description for the widget must match exactly with the string in your input argument.
Matching is case-sensitive.
func (UiSelectorHelper) DescriptionContains ¶
func (s UiSelectorHelper) DescriptionContains(desc string) UiSelectorHelper
DescriptionContains Set the search criteria to match the content-description property for a widget.
The content-description is typically used by the Android Accessibility framework to provide an audio prompt for the widget when the widget is selected. The content-description for the widget must contain the string in your input argument.
Matching is case-insensitive.
func (UiSelectorHelper) DescriptionMatches ¶
func (s UiSelectorHelper) DescriptionMatches(regex string) UiSelectorHelper
DescriptionMatches Set the search criteria to match the content-description property for a widget.
The content-description is typically used by the Android Accessibility framework to provide an audio prompt for the widget when the widget is selected. The content-description for the widget must match exactly with the string in your input argument.
func (UiSelectorHelper) DescriptionStartsWith ¶
func (s UiSelectorHelper) DescriptionStartsWith(desc string) UiSelectorHelper
DescriptionStartsWith Set the search criteria to match the content-description property for a widget.
The content-description is typically used by the Android Accessibility framework to provide an audio prompt for the widget when the widget is selected. The content-description for the widget must start with the string in your input argument.
Matching is case-insensitive.
func (UiSelectorHelper) Enabled ¶
func (s UiSelectorHelper) Enabled(b bool) UiSelectorHelper
Enabled Set the search criteria to match widgets that are enabled.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) Focusable ¶
func (s UiSelectorHelper) Focusable(b bool) UiSelectorHelper
Focusable Set the search criteria to match widgets that are focusable.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) Focused ¶
func (s UiSelectorHelper) Focused(b bool) UiSelectorHelper
Focused Set the search criteria to match widgets that have focus.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) FromParent ¶
func (s UiSelectorHelper) FromParent(selector UiSelectorHelper) UiSelectorHelper
FromParent Adds a child UiSelector criteria to this selector which is used to start search from the parent widget.
Use this selector to narrow the search scope to sibling widgets as well all child widgets under a parent.
func (UiSelectorHelper) Index ¶
func (s UiSelectorHelper) Index(index int) UiSelectorHelper
Index Set the search criteria to match the widget by its node index in the layout hierarchy.
The index value must be 0 or greater.
Using the index can be unreliable and should only be used as a last resort for matching. Instead, consider using the `Instance(int)` method.
func (UiSelectorHelper) Instance ¶
func (s UiSelectorHelper) Instance(instance int) UiSelectorHelper
Instance Set the search criteria to match the widget by its instance number.
The instance value must be 0 or greater, where the first instance is 0.
For example, to simulate a user click on the third image that is enabled in a UI screen, you could specify a a search criteria where the instance is 2, the `className(String)` matches the image widget class, and `enabled(boolean)` is true. The code would look like this:
`new UiSelector().className("android.widget.ImageView") .enabled(true).instance(2);`
func (UiSelectorHelper) LongClickable ¶
func (s UiSelectorHelper) LongClickable(b bool) UiSelectorHelper
LongClickable Set the search criteria to match widgets that are long-clickable.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) PackageNameMatches ¶
func (s UiSelectorHelper) PackageNameMatches(regex string) UiSelectorHelper
PackageNameMatches Set the search criteria to match the package name of the application that contains the widget.
func (UiSelectorHelper) PatternSelector ¶
func (s UiSelectorHelper) PatternSelector(selector UiSelectorHelper) UiSelectorHelper
func (UiSelectorHelper) ResourceId ¶
func (s UiSelectorHelper) ResourceId(id string) UiSelectorHelper
ResourceId Set the search criteria to match the given resource ID.
func (UiSelectorHelper) ResourceIdMatches ¶
func (s UiSelectorHelper) ResourceIdMatches(regex string) UiSelectorHelper
ResourceIdMatches Set the search criteria to match the resource ID of the widget, using a regular expression.
func (UiSelectorHelper) Scrollable ¶
func (s UiSelectorHelper) Scrollable(b bool) UiSelectorHelper
Scrollable Set the search criteria to match widgets that are scrollable.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) Selected ¶
func (s UiSelectorHelper) Selected(b bool) UiSelectorHelper
Selected Set the search criteria to match widgets that are currently selected.
Typically, using this search criteria alone is not useful. You should also include additional criteria, such as text, content-description, or the class name for a widget.
If no other search criteria is specified, and there is more than one matching widget, the first widget in the tree is selected.
func (UiSelectorHelper) String ¶
func (s UiSelectorHelper) String() string
func (UiSelectorHelper) Text ¶
func (s UiSelectorHelper) Text(text string) UiSelectorHelper
Text Set the search criteria to match the visible text displayed in a widget (for example, the text label to launch an app).
The text for the element must match exactly with the string in your input argument. Matching is case-sensitive.
func (UiSelectorHelper) TextContains ¶
func (s UiSelectorHelper) TextContains(text string) UiSelectorHelper
TextContains Set the search criteria to match the visible text in a widget where the visible text must contain the string in your input argument.
The matching is case-sensitive.
func (UiSelectorHelper) TextMatches ¶
func (s UiSelectorHelper) TextMatches(regex string) UiSelectorHelper
TextMatches Set the search criteria to match the visible text displayed in a layout element, using a regular expression.
The text in the widget must match exactly with the string in your input argument.
func (UiSelectorHelper) TextStartsWith ¶
func (s UiSelectorHelper) TextStartsWith(text string) UiSelectorHelper
TextStartsWith Set the search criteria to match visible text in a widget that is prefixed by the text parameter.
The matching is case-insensitive.
type VideoCrawler ¶ added in v4.3.6
type VideoCrawlerConfigs ¶ added in v4.3.4
type VideoCrawlerConfigs struct { Timeout int `json:"timeout"` // seconds Feed FeedConfig `json:"feed"` Live LiveConfig `json:"live"` }
type WebDriver ¶
type WebDriver interface { // NewSession starts a new session and returns the SessionInfo. NewSession(capabilities Capabilities) (SessionInfo, error) // DeleteSession Kills application associated with that session and removes session // 1) alertsMonitor disable // 2) testedApplicationBundleId terminate DeleteSession() error Status() (DeviceStatus, error) DeviceInfo() (DeviceInfo, error) // Location Returns device location data. // // It requires to configure location access permission by manual. // The response of 'latitude', 'longitude' and 'altitude' are always zero (0) without authorization. // 'authorizationStatus' indicates current authorization status. '3' is 'Always'. // https://developer.apple.com/documentation/corelocation/clauthorizationstatus // // Settings -> Privacy -> Location Service -> WebDriverAgent-Runner -> Always // // The return value could be zero even if the permission is set to 'Always' // since the location service needs some time to update the location data. Location() (Location, error) BatteryInfo() (BatteryInfo, error) WindowSize() (Size, error) Screen() (Screen, error) Scale() (float64, error) // GetTimestamp returns the timestamp of the mobile device GetTimestamp() (timestamp int64, err error) // Homescreen Forces the device under test to switch to the home screen Homescreen() error // AppLaunch Launch an application with given bundle identifier in scope of current session. // !This method is only available since Xcode9 SDK AppLaunch(packageName string) error // AppTerminate Terminate an application with the given package name. // Either `true` if the app has been successfully terminated or `false` if it was not running AppTerminate(packageName string) (bool, error) // GetForegroundApp returns current foreground app package name and activity name GetForegroundApp() (app AppInfo, err error) // AssertForegroundApp returns nil if the given package and activity are in foreground AssertForegroundApp(packageName string, activityType ...string) error // StartCamera Starts a new camera for recording StartCamera() error // StopCamera Stops the camera for recording StopCamera() error // Tap Sends a tap event at the coordinate. Tap(x, y int, options ...ActionOption) error TapFloat(x, y float64, options ...ActionOption) error // DoubleTap Sends a double tap event at the coordinate. DoubleTap(x, y int) error DoubleTapFloat(x, y float64) error // TouchAndHold Initiates a long-press gesture at the coordinate, holding for the specified duration. // second: The default value is 1 TouchAndHold(x, y int, second ...float64) error TouchAndHoldFloat(x, y float64, second ...float64) error // Drag Initiates a press-and-hold gesture at the coordinate, then drags to another coordinate. // WithPressDurationOption option can be used to set pressForDuration (default to 1 second). Drag(fromX, fromY, toX, toY int, options ...ActionOption) error DragFloat(fromX, fromY, toX, toY float64, options ...ActionOption) error // Swipe works like Drag, but `pressForDuration` value is 0 Swipe(fromX, fromY, toX, toY int, options ...ActionOption) error SwipeFloat(fromX, fromY, toX, toY float64, options ...ActionOption) error // SetPasteboard Sets data to the general pasteboard SetPasteboard(contentType PasteboardType, content string) error // GetPasteboard Gets the data contained in the general pasteboard. // It worked when `WDA` was foreground. https://github.com/appium/WebDriverAgent/issues/330 GetPasteboard(contentType PasteboardType) (raw *bytes.Buffer, err error) // SendKeys Types a string into active element. There must be element with keyboard focus, // otherwise an error is raised. // WithFrequency option can be used to set frequency of typing (letters per sec). The default value is 60 SendKeys(text string, options ...ActionOption) error // Input works like SendKeys Input(text string, options ...ActionOption) error // PressButton Presses the corresponding hardware button on the device PressButton(devBtn DeviceButton) error // PressBack Presses the back button PressBack(options ...ActionOption) error Screenshot() (*bytes.Buffer, error) // Source Return application elements tree Source(srcOpt ...SourceOption) (string, error) // AccessibleSource Return application elements accessibility tree AccessibleSource() (string, error) // HealthCheck Health check might modify simulator state so it should only be called in-between testing sessions // Checks health of XCTest by: // 1) Querying application for some elements, // 2) Triggering some device events. HealthCheck() error GetAppiumSettings() (map[string]interface{}, error) SetAppiumSettings(settings map[string]interface{}) (map[string]interface{}, error) IsHealthy() (bool, error) // triggers the log capture and returns the log entries StartCaptureLog(identifier ...string) (err error) StopCaptureLog() (result interface{}, err error) }
WebDriver defines methods supported by WebDriver drivers.