uixt

package
v0.0.0-...-64e6d88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2026 License: Apache-2.0 Imports: 72 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EvalInstallerPackageName   = "sogou.mobile.explorer"
	InstallViaInstallerCommand = "am start -S -n sogou.mobile.explorer/.PackageInstallerActivity -d"
)
View Source
const BROWSER_BASE_URL = "http://localhost:8093"

Variables

View Source
var (
	VEDEM_UPLOAD_URL        = os.Getenv("VEDEM_UPLOAD_URL")
	VEDEM_UPLOAD_ACCESS_KEY = os.Getenv("VEDEM_UPLOAD_ACCESS_KEY")
	VEDEM_UPLOAD_TOKEN      = os.Getenv("VEDEM_UPLOAD_TOKEN")
)

Functions

func BuildMCPCallToolRequest

func BuildMCPCallToolRequest(toolName option.ActionName, arguments map[string]any, action option.MobileAction) mcp.CallToolRequest

BuildMCPCallToolRequest is a helper function to build mcp.CallToolRequest

func CleanupAllDrivers

func CleanupAllDrivers()

CleanupAllDrivers cleans up all cached drivers

func CompressImageFile

func CompressImageFile(imagePath string, quality int) ([]byte, error)

CompressImageFile compresses an image file and returns the compressed data

func DetectAndRenameMediaFile

func DetectAndRenameMediaFile(filePath string) (string, error)

DetectAndRenameImageFile examines the file content to determine its media type and renames the file with the appropriate extension (.jpg, .png, .mp4, etc.)

func DownloadFileByUrl

func DownloadFileByUrl(fileUrl string) (filePath string, err error)

func GenerateReturnSchema

func GenerateReturnSchema(toolStruct interface{}) map[string]string

GenerateReturnSchema generates return schema from a struct using reflection

func MarkUIOperation

func MarkUIOperation(driver IDriver, actionType option.ActionName, actionCoordinates []float64) error

MarkUIOperation add operation mark for UI operation

func NewMCPErrorResponse

func NewMCPErrorResponse(message string) *mcp.CallToolResult

NewMCPErrorResponse creates an error MCP response

func NewMCPSuccessResponse

func NewMCPSuccessResponse(message string, actionTool ActionTool) *mcp.CallToolResult

NewMCPSuccessResponse creates a successful response with structured data

func RebootTunnel

func RebootTunnel() (err error)

func RegisterXTDriver

func RegisterXTDriver(serial string, driver *XTDriver) error

RegisterXTDriver registers an externally created XTDriver to the unified cache

func ReleaseXTDriver

func ReleaseXTDriver(serial string) error

ReleaseXTDriver decrements reference count and removes from cache when count reaches zero

func SaveImageWithArrowMarker

func SaveImageWithArrowMarker(imgBuf *bytes.Buffer, from, to image.Point, outputPath string) error

SaveImageWithArrowMarker saves an image with an arrow marker

func SaveImageWithCircleMarker

func SaveImageWithCircleMarker(imgBuf *bytes.Buffer, point image.Point, outputPath string) error

SaveImageWithCircleMarker saves an image with circle marker

func SetUseMCPExecution

func SetUseMCPExecution(enabled bool)

SetUseMCPExecution sets whether to execute actions via MCP client or directly.

func StartTunnel

func StartTunnel(ctx context.Context, recordsPath string, tunnelInfoPort int, userspaceTUN bool) (err error)

func UseMCPExecution

func UseMCPExecution() bool

UseMCPExecution returns current execution mode.

Types

type ADBDriver

type ADBDriver struct {
	Device  *AndroidDevice
	Session *DriverSession
	// contains filtered or unexported fields
}

func NewADBDriver

func NewADBDriver(device *AndroidDevice) (*ADBDriver, error)

func (*ADBDriver) AppClear

func (ad *ADBDriver) AppClear(packageName string) error

func (*ADBDriver) AppLaunch

func (ad *ADBDriver) AppLaunch(packageName string) (err error)

func (*ADBDriver) AppTerminate

func (ad *ADBDriver) AppTerminate(packageName string) (successful bool, err error)

func (*ADBDriver) Back

func (ad *ADBDriver) Back() (err error)

Back simulates a short press on the BACK button.

func (*ADBDriver) Backspace

func (ad *ADBDriver) Backspace(count int, opts ...option.ActionOption) (err error)

func (*ADBDriver) BatteryInfo

func (ad *ADBDriver) BatteryInfo() (batteryInfo types.BatteryInfo, err error)

func (*ADBDriver) ClearFiles

func (ad *ADBDriver) ClearFiles(paths ...string) error

func (*ADBDriver) ClearImages

func (ad *ADBDriver) ClearImages() error

func (*ADBDriver) DeleteSession

func (ad *ADBDriver) DeleteSession() error

func (*ADBDriver) DeviceInfo

func (ad *ADBDriver) DeviceInfo() (deviceInfo types.DeviceInfo, err error)

func (*ADBDriver) DoubleTap

func (ad *ADBDriver) DoubleTap(x, y float64, opts ...option.ActionOption) error

func (*ADBDriver) Drag

func (ad *ADBDriver) Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) (err error)

func (*ADBDriver) ForceTouch

func (ad *ADBDriver) ForceTouch(x, y int, pressure float64, second ...float64) error

func (*ADBDriver) ForceTouchFloat

func (ad *ADBDriver) ForceTouchFloat(x, y, pressure float64, second ...float64) (err error)

func (*ADBDriver) ForegroundInfo

func (ad *ADBDriver) ForegroundInfo() (app types.AppInfo, err error)

func (*ADBDriver) GetDevice

func (ad *ADBDriver) GetDevice() IDevice

func (*ADBDriver) GetIme

func (ad *ADBDriver) GetIme() (ime string, err error)

func (*ADBDriver) GetPasteboard

func (ad *ADBDriver) GetPasteboard() (content string, err error)

func (*ADBDriver) GetSession

func (ad *ADBDriver) GetSession() *DriverSession

func (*ADBDriver) Home

func (ad *ADBDriver) Home() (err error)

func (*ADBDriver) HoverBySelector

func (ad *ADBDriver) HoverBySelector(selector string, options ...option.ActionOption) (err error)

func (*ADBDriver) InitSession

func (ad *ADBDriver) InitSession(capabilities option.Capabilities) error

func (*ADBDriver) Input

func (ad *ADBDriver) Input(text string, opts ...option.ActionOption) error

func (*ADBDriver) IsAdbKeyBoardInstalled

func (ad *ADBDriver) IsAdbKeyBoardInstalled() bool

func (*ADBDriver) IsUnicodeIMEInstalled

func (ad *ADBDriver) IsUnicodeIMEInstalled() bool

func (*ADBDriver) ListIme

func (ad *ADBDriver) ListIme() []string

func (*ADBDriver) OpenUrl

func (ad *ADBDriver) OpenUrl(url string) (err error)

func (*ADBDriver) Orientation

func (ad *ADBDriver) Orientation() (orientation types.Orientation, err error)

func (*ADBDriver) PressButton

func (ad *ADBDriver) PressButton(button types.DeviceButton) error

func (*ADBDriver) PressKeyCode

func (ad *ADBDriver) PressKeyCode(keyCode KeyCode, metaState KeyMeta) (err error)

func (*ADBDriver) PullFiles

func (ad *ADBDriver) PullFiles(localDir string, remoteDirs ...string) error

func (*ADBDriver) PullImages

func (ad *ADBDriver) PullImages(localDir string) error

PullImages pulls all images from device's DCIM/Camera directory to local directory

func (*ADBDriver) PushFile

func (ad *ADBDriver) PushFile(localPath string, remoteDir string) error

func (*ADBDriver) PushImage

func (ad *ADBDriver) PushImage(localPath string) error

func (*ADBDriver) Rotation

func (ad *ADBDriver) Rotation() (rotation types.Rotation, err error)

func (*ADBDriver) ScreenRecord

func (ad *ADBDriver) ScreenRecord(opts ...option.ActionOption) (videoPath string, err error)

func (*ADBDriver) ScreenShot

func (ad *ADBDriver) ScreenShot(opts ...option.ActionOption) (raw *bytes.Buffer, err error)

func (*ADBDriver) SecondaryClick

func (ad *ADBDriver) SecondaryClick(x, y float64) (err error)

func (*ADBDriver) SecondaryClickBySelector

func (ad *ADBDriver) SecondaryClickBySelector(selector string, options ...option.ActionOption) (err error)

func (*ADBDriver) SendKeysByAdbKeyBoard

func (ad *ADBDriver) SendKeysByAdbKeyBoard(text string) (err error)

func (*ADBDriver) SendUnicodeKeys

func (ad *ADBDriver) SendUnicodeKeys(text string, opts ...option.ActionOption) (err error)

func (*ADBDriver) SetIme

func (ad *ADBDriver) SetIme(imeRegx string) error

func (*ADBDriver) SetRotation

func (ad *ADBDriver) SetRotation(rotation types.Rotation) (err error)

func (*ADBDriver) Setup

func (ad *ADBDriver) Setup() error

func (*ADBDriver) Source

func (ad *ADBDriver) Source(srcOpt ...option.SourceOption) (source string, err error)

func (*ADBDriver) StartCaptureLog

func (ad *ADBDriver) StartCaptureLog(identifier ...string) (err error)

func (*ADBDriver) Status

func (ad *ADBDriver) Status() (deviceStatus types.DeviceStatus, err error)

func (*ADBDriver) StopCaptureLog

func (ad *ADBDriver) StopCaptureLog() (result interface{}, err error)

func (*ADBDriver) Swipe

func (ad *ADBDriver) Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

func (*ADBDriver) TapAbsXY

func (ad *ADBDriver) TapAbsXY(x, y float64, opts ...option.ActionOption) error

func (*ADBDriver) TapBySelector

func (ad *ADBDriver) TapBySelector(selector string, opts ...option.ActionOption) error

func (*ADBDriver) TapByXpath

func (ud *ADBDriver) TapByXpath(xpath string, opts ...option.ActionOption) (err error)

func (*ADBDriver) TapXY

func (ad *ADBDriver) TapXY(x, y float64, opts ...option.ActionOption) error

func (*ADBDriver) TearDown

func (ad *ADBDriver) TearDown() error

func (*ADBDriver) TouchAndHold

func (ad *ADBDriver) TouchAndHold(x, y float64, opts ...option.ActionOption) (err error)

func (*ADBDriver) Unlock

func (ad *ADBDriver) Unlock() (err error)

func (*ADBDriver) WindowSize

func (ad *ADBDriver) WindowSize() (size types.Size, err error)

type AIExecutionResult

type AIExecutionResult struct {
	Type              string      `json:"type"`               // operation type: "query", "action", "assert"
	ModelCallElapsed  int64       `json:"model_call_elapsed"` // model call elapsed time in milliseconds
	ScreenshotElapsed int64       `json:"screenshot_elapsed"` // screenshot elapsed time in milliseconds
	ImagePath         string      `json:"image_path"`         // path to screenshot used for operation
	Resolution        *types.Size `json:"resolution"`         // screen resolution

	// Operation-specific results (only one will be populated based on Type)
	QueryResult     *ai.QueryResult     `json:"query_result,omitempty"`     // for ai_query operations
	PlanningResult  *ai.PlanningResult  `json:"planning_result,omitempty"`  // for ai_action operations
	AssertionResult *ai.AssertionResult `json:"assertion_result,omitempty"` // for ai_assert operations

	// Common fields
	Error string `json:"error,omitempty"` // error message if operation failed
}

AIExecutionResult represents a unified result structure for all AI operations

type Action

type Action func(driver *XTDriver) error

type ActionTool

type ActionTool interface {
	Name() option.ActionName
	Description() string
	Options() []mcp.ToolOption
	Implement() server.ToolHandlerFunc
	// ConvertActionToCallToolRequest converts MobileAction to mcp.CallToolRequest
	ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)
}

ActionTool interface defines the contract for MCP tools

type AdbLogcat

type AdbLogcat struct {
	// contains filtered or unexported fields
}

func NewAdbLogcat

func NewAdbLogcat(serial string) *AdbLogcat

func NewAdbLogcatWithCallback

func NewAdbLogcatWithCallback(serial string, callback LineCallback) *AdbLogcat

func (*AdbLogcat) CatchLogcat

func (l *AdbLogcat) CatchLogcat(filter string) (err error)

func (*AdbLogcat) CatchLogcatContext

func (l *AdbLogcat) CatchLogcatContext(timeoutCtx context.Context) (err error)

CatchLogcatContext starts logcat with timeout context

func (*AdbLogcat) Errors

func (l *AdbLogcat) Errors() (err error)

func (*AdbLogcat) Stop

func (l *AdbLogcat) Stop() error

type AndroidDevice

type AndroidDevice struct {
	*gadb.Device
	Options *option.AndroidDeviceOptions
	Logcat  *AdbLogcat
}

func NewAndroidDevice

func NewAndroidDevice(opts ...option.AndroidDeviceOption) (device *AndroidDevice, err error)

func (*AndroidDevice) GetAppInfo

func (dev *AndroidDevice) GetAppInfo(packageName string) (app types.AppInfo, err error)

func (*AndroidDevice) GetCurrentWindow

func (dev *AndroidDevice) GetCurrentWindow() (windowInfo types.WindowInfo, err error)

func (*AndroidDevice) GetPackageInfo

func (dev *AndroidDevice) GetPackageInfo(packageName string) (types.AppInfo, error)

func (*AndroidDevice) Install

func (dev *AndroidDevice) Install(apkPath string, opts ...option.InstallOption) error

func (*AndroidDevice) IsHealthy

func (dev *AndroidDevice) IsHealthy() (bool, error)

func (*AndroidDevice) ListPackages

func (dev *AndroidDevice) ListPackages() ([]string, error)

func (*AndroidDevice) LogEnabled

func (dev *AndroidDevice) LogEnabled() bool

func (*AndroidDevice) NewCompositeDriverDirect

func (dev *AndroidDevice) NewCompositeDriverDirect() (*CompositeDriver, error)

NewCompositeDriverDirect creates a CompositeDriver directly (convenience method)

func (*AndroidDevice) NewDriver

func (dev *AndroidDevice) NewDriver() (driver IDriver, err error)

func (*AndroidDevice) RunShellCommand

func (dev *AndroidDevice) RunShellCommand(cmd string, args ...string) (string, error)

RunShellCommand executes adb shell command with a host-side timeout.

Motivation: Some shell commands (notably `uiautomator dump`) may hang on certain devices/ROMs. Even if upper-layer contexts are cancelled (e.g. case timeout), the underlying gadb shell call may keep blocking, which makes the whole step appear "stuck" for minutes.

This method shadows the embedded gadb.Device.RunShellCommand and uses `exec.CommandContext` so cancellation/timeout can reliably stop the host-side adb process.

Note: We execute via `sh -c` to support pipes/redirection patterns used in this repo (e.g. "dumpsys window | grep ...").

func (*AndroidDevice) RunShellCommandWithContext

func (dev *AndroidDevice) RunShellCommandWithContext(ctx context.Context, cmd string, args ...string) (string, error)

RunShellCommandWithContext executes adb shell command with the provided context. If ctx has no deadline, a conservative default (10s) will be applied.

func (*AndroidDevice) ScreenShot

func (dev *AndroidDevice) ScreenShot() (*bytes.Buffer, error)

func (*AndroidDevice) Setup

func (dev *AndroidDevice) Setup() error

func (*AndroidDevice) Teardown

func (dev *AndroidDevice) Teardown() error

func (*AndroidDevice) UUID

func (dev *AndroidDevice) UUID() string

func (*AndroidDevice) Uninstall

func (dev *AndroidDevice) Uninstall(packageName string) error

type ApplicationType

type ApplicationType string
const (
	ApplicationTypeSystem   ApplicationType = "System"
	ApplicationTypeUser     ApplicationType = "User"
	ApplicationTypeInternal ApplicationType = "internal"
	ApplicationTypeAny      ApplicationType = "Any"
)

type Attachments

type Attachments map[string]interface{}

type Attributes

type Attributes struct {
	Index   int    `xml:"index,attr"`
	Package string `xml:"package,attr"`
	Class   string `xml:"class,attr"`
	Text    string `xml:"text,attr"`
	// ContentDesc maps Android's `content-desc` attribute, which is widely used
	// by apps (including QQ/WeChat) to label icon-only buttons such as search.
	// Previously we ignored this attribute, which meant elements without `text`
	// but with `content-desc="搜索"` could not be found via TapBySelector("搜索").
	ContentDesc   string  `xml:"content-desc,attr"`
	ResourceId    string  `xml:"resource-id,attr"`
	Checkable     bool    `xml:"checkable,attr"`
	Checked       bool    `xml:"checked,attr"`
	Clickable     bool    `xml:"clickable,attr"`
	Enabled       bool    `xml:"enabled,attr"`
	Focusable     bool    `xml:"focusable,attr"`
	Focused       bool    `xml:"focused,attr"`
	LongClickable bool    `xml:"long-clickable,attr"`
	Password      bool    `xml:"password,attr"`
	Scrollable    bool    `xml:"scrollable,attr"`
	Selected      bool    `xml:"selected,attr"`
	Bounds        *Bounds `xml:"bounds,attr"`
	Displayed     bool    `xml:"displayed,attr"`
}

type Bounds

type Bounds struct {
	X1, Y1, X2, Y2 int
}

func (*Bounds) Center

func (b *Bounds) Center() (float64, float64)

func (*Bounds) UnmarshalXMLAttr

func (b *Bounds) UnmarshalXMLAttr(attr xml.Attr) error

type BrowserDevice

type BrowserDevice struct {
	Options *option.BrowserDeviceOptions
}

func NewBrowserDevice

func NewBrowserDevice(opts ...option.BrowserDeviceOption) (device *BrowserDevice, err error)

func (*BrowserDevice) GetPackageInfo

func (dev *BrowserDevice) GetPackageInfo(packageName string) (types.AppInfo, error)

func (*BrowserDevice) Install

func (dev *BrowserDevice) Install(appPath string, opts ...option.InstallOption) error

func (*BrowserDevice) IsHealthy

func (dev *BrowserDevice) IsHealthy() (bool, error)

func (*BrowserDevice) ListPackages

func (dev *BrowserDevice) ListPackages() ([]string, error)

func (*BrowserDevice) LogEnabled

func (dev *BrowserDevice) LogEnabled() bool

func (*BrowserDevice) NewDriver

func (dev *BrowserDevice) NewDriver() (driver IDriver, err error)

func (*BrowserDevice) ScreenShot

func (dev *BrowserDevice) ScreenShot() (*bytes.Buffer, error)

func (*BrowserDevice) Setup

func (dev *BrowserDevice) Setup() error

func (*BrowserDevice) Teardown

func (dev *BrowserDevice) Teardown() error

func (*BrowserDevice) UUID

func (dev *BrowserDevice) UUID() string

func (*BrowserDevice) Uninstall

func (dev *BrowserDevice) Uninstall(packageName string) error

type BrowserDriver

type BrowserDriver struct {
	Session *DriverSession
	Device  *BrowserDevice
}

func NewBrowserDriver

func NewBrowserDriver(device *BrowserDevice) (driver *BrowserDriver, err error)

func (*BrowserDriver) AccessibleSource

func (wd *BrowserDriver) AccessibleSource() (string, error)

AccessibleSource Return application elements accessibility tree

func (*BrowserDriver) AppClear

func (wd *BrowserDriver) AppClear(packageName string) error

func (*BrowserDriver) AppLaunch

func (wd *BrowserDriver) AppLaunch(packageName string) (err error)

func (*BrowserDriver) AppTerminate

func (wd *BrowserDriver) AppTerminate(packageName string) (bool, 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

func (*BrowserDriver) Back

func (wd *BrowserDriver) Back() error

func (*BrowserDriver) Backspace

func (wd *BrowserDriver) Backspace(count int, options ...option.ActionOption) (err error)

func (*BrowserDriver) BatteryInfo

func (wd *BrowserDriver) BatteryInfo() (batteryInfo types.BatteryInfo, err error)

func (*BrowserDriver) Clear

func (wd *BrowserDriver) Clear(packageName string) error

func (*BrowserDriver) ClearFiles

func (wd *BrowserDriver) ClearFiles(paths ...string) error

func (*BrowserDriver) ClearImages

func (wd *BrowserDriver) ClearImages() error

func (*BrowserDriver) CloseTab

func (wd *BrowserDriver) CloseTab(pageIndex int) (err error)

func (*BrowserDriver) CreateNetListener

func (wd *BrowserDriver) CreateNetListener() (*websocket.Conn, error)

func (*BrowserDriver) CustomeGet

func (wd *BrowserDriver) CustomeGet(urlStr string) (response *WebAgentResponse, err error)

func (*BrowserDriver) CustomePost

func (wd *BrowserDriver) CustomePost(data interface{}, urlStr string) (response *WebAgentResponse, err error)

func (*BrowserDriver) DeleteSession

func (wd *BrowserDriver) DeleteSession() (err error)

func (*BrowserDriver) DeviceInfo

func (wd *BrowserDriver) DeviceInfo() (deviceInfo types.DeviceInfo, err error)

func (*BrowserDriver) DoubleTap

func (wd *BrowserDriver) DoubleTap(x, y float64, options ...option.ActionOption) error

DoubleTap Sends a double tap event at the coordinate.

func (*BrowserDriver) Drag

func (wd *BrowserDriver) Drag(fromX, fromY, toX, toY float64, options ...option.ActionOption) (err error)

func (*BrowserDriver) ForegroundInfo

func (wd *BrowserDriver) ForegroundInfo() (app types.AppInfo, err error)

func (*BrowserDriver) GetAppiumSettings

func (wd *BrowserDriver) GetAppiumSettings() (map[string]interface{}, error)

func (*BrowserDriver) GetDevice

func (wd *BrowserDriver) GetDevice() IDevice

func (*BrowserDriver) GetElementTextBySelector

func (wd *BrowserDriver) GetElementTextBySelector(selector string, options ...option.ActionOption) (text string, err error)

func (*BrowserDriver) GetPageUrl

func (wd *BrowserDriver) GetPageUrl(options ...option.ActionOption) (text string, err error)

func (*BrowserDriver) GetPasteboard

func (wd *BrowserDriver) GetPasteboard() (content string, err error)

func (*BrowserDriver) GetSession

func (wd *BrowserDriver) GetSession() *DriverSession

func (*BrowserDriver) GetTimestamp

func (wd *BrowserDriver) GetTimestamp() (timestamp int64, err error)

GetTimestamp returns the timestamp of the mobile device

func (*BrowserDriver) HealthCheck

func (wd *BrowserDriver) HealthCheck() 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.

func (*BrowserDriver) Home

func (wd *BrowserDriver) Home() error

func (*BrowserDriver) Homescreen

func (wd *BrowserDriver) Homescreen() error

Homescreen Forces the device under test to switch to the home screen

func (*BrowserDriver) Hover

func (wd *BrowserDriver) Hover(x, y float64) (err error)

func (*BrowserDriver) HoverBySelector

func (wd *BrowserDriver) HoverBySelector(selector string, options ...option.ActionOption) (err error)

func (*BrowserDriver) InitSession

func (wd *BrowserDriver) InitSession(capabilities option.Capabilities) error

func (*BrowserDriver) Input

func (wd *BrowserDriver) Input(text string, option ...option.ActionOption) (err error)

func (*BrowserDriver) IsElementExistBySelector

func (wd *BrowserDriver) IsElementExistBySelector(selector string) (bool, error)

func (*BrowserDriver) IsHealthy

func (wd *BrowserDriver) IsHealthy() (bool, error)

func (*BrowserDriver) Keyboard

func (wd *BrowserDriver) Keyboard(key string) (err error)

func (*BrowserDriver) LoginNoneUI

func (wd *BrowserDriver) LoginNoneUI(packageName, phoneNumber string, captcha, password string) (success bool, err error)

func (*BrowserDriver) LogoutNoneUI

func (wd *BrowserDriver) LogoutNoneUI(packageName string) error

func (*BrowserDriver) Orientation

func (wd *BrowserDriver) Orientation() (orientation types.Orientation, err error)

func (*BrowserDriver) PageAction

func (wd *BrowserDriver) PageAction(action string) (err error)

func (*BrowserDriver) PressBack

func (wd *BrowserDriver) PressBack(options ...option.ActionOption) error

PressBack Presses the back button

func (*BrowserDriver) PressButton

func (wd *BrowserDriver) PressButton(button types.DeviceButton) error

func (*BrowserDriver) PullFiles

func (wd *BrowserDriver) PullFiles(localDir string, remoteDirs ...string) error

func (*BrowserDriver) PullImages

func (wd *BrowserDriver) PullImages(localDir string) error

func (*BrowserDriver) PushFile

func (wd *BrowserDriver) PushFile(localPath string, remoteDir string) error

func (*BrowserDriver) PushImage

func (wd *BrowserDriver) PushImage(localPath string) error

func (*BrowserDriver) RecordScreen

func (wd *BrowserDriver) RecordScreen(folderPath string, duration time.Duration) (videoPath string, err error)

func (*BrowserDriver) Rotation

func (wd *BrowserDriver) Rotation() (rotation types.Rotation, err error)

func (*BrowserDriver) Scale

func (wd *BrowserDriver) Scale() (float64, error)

func (*BrowserDriver) Screen

func (wd *BrowserDriver) Screen() (Screen, error)

func (*BrowserDriver) ScreenRecord

func (wd *BrowserDriver) ScreenRecord(opts ...option.ActionOption) (videoPath string, err error)

func (*BrowserDriver) ScreenShot

func (wd *BrowserDriver) ScreenShot(options ...option.ActionOption) (*bytes.Buffer, error)

func (*BrowserDriver) Scroll

func (wd *BrowserDriver) Scroll(delta int) (err error)

func (*BrowserDriver) SecondaryClick

func (wd *BrowserDriver) SecondaryClick(x, y float64) (err error)

func (*BrowserDriver) SecondaryClickBySelector

func (wd *BrowserDriver) SecondaryClickBySelector(selector string, options ...option.ActionOption) (err error)

func (*BrowserDriver) SendKeys

func (wd *BrowserDriver) SendKeys(text string, options ...option.ActionOption) 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

func (*BrowserDriver) SetAppiumSettings

func (wd *BrowserDriver) SetAppiumSettings(settings map[string]interface{}) (map[string]interface{}, error)

func (*BrowserDriver) SetHeader

func (wd *BrowserDriver) SetHeader(headers string) (err error)

func (*BrowserDriver) SetIme

func (wd *BrowserDriver) SetIme(ime string) error

func (*BrowserDriver) SetRotation

func (wd *BrowserDriver) SetRotation(rotation types.Rotation) error

func (*BrowserDriver) Setup

func (wd *BrowserDriver) Setup() error

func (*BrowserDriver) Source

func (wd *BrowserDriver) Source(srcOpt ...option.SourceOption) (string, error)

Source Return application elements tree

func (*BrowserDriver) StartCaptureLog

func (wd *BrowserDriver) StartCaptureLog(identifier ...string) (err error)

triggers the log capture and returns the log entries

func (*BrowserDriver) Status

func (wd *BrowserDriver) Status() (deviceStatus types.DeviceStatus, err error)

func (*BrowserDriver) StopCaptureLog

func (wd *BrowserDriver) StopCaptureLog() (result interface{}, err error)

func (*BrowserDriver) Swipe

func (wd *BrowserDriver) Swipe(fromX, fromY, toX, toY float64, options ...option.ActionOption) error

Swipe works like Drag, but `pressForDuration` value is 0

func (*BrowserDriver) SwipeFloat

func (wd *BrowserDriver) SwipeFloat(fromX, fromY, toX, toY float64, options ...option.ActionOption) error

func (*BrowserDriver) Tap

func (wd *BrowserDriver) Tap(x, y float64, options ...option.ActionOption) error

Tap Sends a tap event at the coordinate.

func (*BrowserDriver) TapAbsXY

func (wd *BrowserDriver) TapAbsXY(x, y float64, opts ...option.ActionOption) error

func (*BrowserDriver) TapBySelector

func (wd *BrowserDriver) TapBySelector(selector string, options ...option.ActionOption) (err error)

func (*BrowserDriver) TapByText

func (wd *BrowserDriver) TapByText(text string, options ...option.ActionOption) error

func (*BrowserDriver) TapFloat

func (wd *BrowserDriver) TapFloat(x, y float64, opts ...option.ActionOption) error

func (*BrowserDriver) TapXY

func (wd *BrowserDriver) TapXY(x, y float64, opts ...option.ActionOption) error

func (*BrowserDriver) TearDown

func (wd *BrowserDriver) TearDown() error

func (*BrowserDriver) TouchAndHold

func (wd *BrowserDriver) TouchAndHold(x, y float64, options ...option.ActionOption) error

TouchAndHold Initiates a long-press gesture at the coordinate, holding for the specified duration.

second: The default value is 1

func (*BrowserDriver) Unlock

func (wd *BrowserDriver) Unlock() (err error)

func (*BrowserDriver) UploadFile

func (wd *BrowserDriver) UploadFile(x, y float64, FileUrl, FileFormat string) (err error)

func (*BrowserDriver) WindowSize

func (wd *BrowserDriver) WindowSize() (types.Size, error)

type BrowserInfo

type BrowserInfo struct {
	ContextId string `json:"context_id"`
}

func CreateBrowser

func CreateBrowser(timeout int, width, height int) (browserInfo *BrowserInfo, err error)

type CacheManager

type CacheManager[T any] struct {
	// contains filtered or unexported fields
}

CacheManager provides a generic cache management interface

func NewCacheManager

func NewCacheManager[T any](name string, cleanup func(T) error) *CacheManager[T]

NewCacheManager creates a new cache manager

func (*CacheManager[T]) Clear

func (cm *CacheManager[T]) Clear()

Clear removes all items from cache

func (*CacheManager[T]) Get

func (cm *CacheManager[T]) Get(key string) (*CachedItem[T], bool)

Get retrieves an item from cache

func (*CacheManager[T]) GetOrCreate

func (cm *CacheManager[T]) GetOrCreate(key string, factory func() (T, map[string]interface{}, error)) (T, error)

GetOrCreate gets an existing item or creates a new one using the provided factory function

func (*CacheManager[T]) List

func (cm *CacheManager[T]) List() []CachedItem[T]

List returns all cached items

func (*CacheManager[T]) Release

func (cm *CacheManager[T]) Release(key string) error

Release decrements reference count and removes item if count reaches zero

func (*CacheManager[T]) Set

func (cm *CacheManager[T]) Set(key string, item T, metadata map[string]interface{}) *CachedItem[T]

Set stores an item in cache

func (*CacheManager[T]) Size

func (cm *CacheManager[T]) Size() int

Size returns the number of items in cache

type CachedItem

type CachedItem[T any] struct {
	Key      string
	Item     T
	RefCount int32
	Metadata map[string]interface{} // additional metadata
}

CachedItem wraps an item with cache metadata

type CachedXTDriver

type CachedXTDriver = CachedItem[*XTDriver]

CachedXTDriver is an alias for CachedItem[*XTDriver] for backward compatibility

func ListCachedDrivers

func ListCachedDrivers() []CachedXTDriver

ListCachedDrivers returns information about all cached drivers

type CompositeDriver

type CompositeDriver struct {
	// contains filtered or unexported fields
}

CompositeDriver is a driver that can dynamically switch between ADB and UIA2 drivers for each operation based on ActionOption.DriverType

func NewCompositeDriver

func NewCompositeDriver(device *AndroidDevice) (*CompositeDriver, error)

NewCompositeDriver creates a new CompositeDriver with both ADB and UIA2 drivers initialized

func (*CompositeDriver) AppClear

func (cd *CompositeDriver) AppClear(packageName string) error

func (*CompositeDriver) AppLaunch

func (cd *CompositeDriver) AppLaunch(packageName string) error

func (*CompositeDriver) AppTerminate

func (cd *CompositeDriver) AppTerminate(packageName string) (bool, error)

func (*CompositeDriver) Back

func (cd *CompositeDriver) Back() error

func (*CompositeDriver) Backspace

func (cd *CompositeDriver) Backspace(count int, opts ...option.ActionOption) error

func (*CompositeDriver) BatteryInfo

func (cd *CompositeDriver) BatteryInfo() (types.BatteryInfo, error)

func (*CompositeDriver) ClearFiles

func (cd *CompositeDriver) ClearFiles(paths ...string) error

func (*CompositeDriver) ClearImages

func (cd *CompositeDriver) ClearImages() error

func (*CompositeDriver) DeleteSession

func (cd *CompositeDriver) DeleteSession() error

func (*CompositeDriver) DeviceInfo

func (cd *CompositeDriver) DeviceInfo() (types.DeviceInfo, error)

func (*CompositeDriver) DoubleTap

func (cd *CompositeDriver) DoubleTap(x, y float64, opts ...option.ActionOption) error

func (*CompositeDriver) Drag

func (cd *CompositeDriver) Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

func (*CompositeDriver) ForegroundInfo

func (cd *CompositeDriver) ForegroundInfo() (types.AppInfo, error)

func (*CompositeDriver) GetADBDriver

func (cd *CompositeDriver) GetADBDriver() *ADBDriver

GetADBDriver returns the underlying ADB driver for direct access

func (*CompositeDriver) GetDefaultDriverType

func (cd *CompositeDriver) GetDefaultDriverType() option.DriverType

GetDefaultDriverType returns the current default driver type

func (*CompositeDriver) GetDevice

func (cd *CompositeDriver) GetDevice() IDevice

func (*CompositeDriver) GetPasteboard

func (cd *CompositeDriver) GetPasteboard() (string, error)

func (*CompositeDriver) GetSession

func (cd *CompositeDriver) GetSession() *DriverSession

func (*CompositeDriver) GetUIA2Driver

func (cd *CompositeDriver) GetUIA2Driver() *UIA2Driver

GetUIA2Driver returns the underlying UIA2 driver for direct access Returns nil if UIA2 is not available

func (*CompositeDriver) Home

func (cd *CompositeDriver) Home() error

func (*CompositeDriver) HoverBySelector

func (cd *CompositeDriver) HoverBySelector(selector string, opts ...option.ActionOption) error

func (*CompositeDriver) InitSession

func (cd *CompositeDriver) InitSession(capabilities option.Capabilities) error

func (*CompositeDriver) Input

func (cd *CompositeDriver) Input(text string, opts ...option.ActionOption) error

func (*CompositeDriver) IsUIA2Available

func (cd *CompositeDriver) IsUIA2Available() bool

IsUIA2Available returns true if UIA2 driver is available

func (*CompositeDriver) Orientation

func (cd *CompositeDriver) Orientation() (types.Orientation, error)

func (*CompositeDriver) PressButton

func (cd *CompositeDriver) PressButton(button types.DeviceButton) error

func (*CompositeDriver) PullFiles

func (cd *CompositeDriver) PullFiles(localDir string, remoteDirs ...string) error

func (*CompositeDriver) PullImages

func (cd *CompositeDriver) PullImages(localDir string) error

func (*CompositeDriver) PushFile

func (cd *CompositeDriver) PushFile(localPath string, remoteDir string) error

func (*CompositeDriver) PushImage

func (cd *CompositeDriver) PushImage(localPath string) error

func (*CompositeDriver) Rotation

func (cd *CompositeDriver) Rotation() (types.Rotation, error)

func (*CompositeDriver) SIMClickAtPoint

func (cd *CompositeDriver) SIMClickAtPoint(x, y float64, opts ...option.ActionOption) error

func (*CompositeDriver) SIMInput

func (cd *CompositeDriver) SIMInput(text string, opts ...option.ActionOption) error

func (*CompositeDriver) SIMSwipeFromPointToPoint

func (cd *CompositeDriver) SIMSwipeFromPointToPoint(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

func (*CompositeDriver) SIMSwipeInArea

func (cd *CompositeDriver) SIMSwipeInArea(direction string, simAreaStartX, simAreaStartY, simAreaEndX, simAreaEndY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error

func (*CompositeDriver) SIMSwipeWithDirection

func (cd *CompositeDriver) SIMSwipeWithDirection(direction string, fromX, fromY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error

func (*CompositeDriver) ScreenRecord

func (cd *CompositeDriver) ScreenRecord(opts ...option.ActionOption) (string, error)

func (*CompositeDriver) ScreenShot

func (cd *CompositeDriver) ScreenShot(opts ...option.ActionOption) (*bytes.Buffer, error)

func (*CompositeDriver) SecondaryClick

func (cd *CompositeDriver) SecondaryClick(x, y float64) error

func (*CompositeDriver) SecondaryClickBySelector

func (cd *CompositeDriver) SecondaryClickBySelector(selector string, opts ...option.ActionOption) error

func (*CompositeDriver) SetDefaultDriverType

func (cd *CompositeDriver) SetDefaultDriverType(dt option.DriverType)

SetDefaultDriverType sets the default driver type for operations without explicit driver type

func (*CompositeDriver) SetIme

func (cd *CompositeDriver) SetIme(ime string) error

func (*CompositeDriver) SetRotation

func (cd *CompositeDriver) SetRotation(rotation types.Rotation) error

func (*CompositeDriver) Setup

func (cd *CompositeDriver) Setup() error

func (*CompositeDriver) Source

func (cd *CompositeDriver) Source(srcOpt ...option.SourceOption) (string, error)

func (*CompositeDriver) StartCaptureLog

func (cd *CompositeDriver) StartCaptureLog(identifier ...string) error

func (*CompositeDriver) Status

func (cd *CompositeDriver) Status() (types.DeviceStatus, error)

func (*CompositeDriver) StopCaptureLog

func (cd *CompositeDriver) StopCaptureLog() (interface{}, error)

func (*CompositeDriver) Swipe

func (cd *CompositeDriver) Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

func (*CompositeDriver) TapAbsXY

func (cd *CompositeDriver) TapAbsXY(x, y float64, opts ...option.ActionOption) error

func (*CompositeDriver) TapBySelector

func (cd *CompositeDriver) TapBySelector(selector string, opts ...option.ActionOption) error

func (*CompositeDriver) TapXY

func (cd *CompositeDriver) TapXY(x, y float64, opts ...option.ActionOption) error

func (*CompositeDriver) TearDown

func (cd *CompositeDriver) TearDown() error

func (*CompositeDriver) TouchAndHold

func (cd *CompositeDriver) TouchAndHold(x, y float64, opts ...option.ActionOption) error

func (*CompositeDriver) Unlock

func (cd *CompositeDriver) Unlock() error

func (*CompositeDriver) WindowSize

func (cd *CompositeDriver) WindowSize() (types.Size, error)

type CreateBrowserResponse

type CreateBrowserResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"msg"`
	Data    BrowserInfo `json:"data"`
}

type DeviceDetail

type DeviceDetail struct {
	DeviceName        string `json:"deviceName,omitempty"`
	DeviceClass       string `json:"deviceClass,omitempty"`
	ProductVersion    string `json:"productVersion,omitempty"`
	ProductType       string `json:"productType,omitempty"`
	ProductName       string `json:"productName,omitempty"`
	PasswordProtected bool   `json:"passwordProtected,omitempty"`
	ModelNumber       string `json:"modelNumber,omitempty"`
	SerialNumber      string `json:"serialNumber,omitempty"`
	SIMStatus         string `json:"simStatus,omitempty"`
	PhoneNumber       string `json:"phoneNumber,omitempty"`
	CPUArchitecture   string `json:"cpuArchitecture,omitempty"`
	ProtocolVersion   string `json:"protocolVersion,omitempty"`
	RegionInfo        string `json:"regionInfo,omitempty"`
	TimeZone          string `json:"timeZone,omitempty"`
	UniqueDeviceID    string `json:"uniqueDeviceID,omitempty"`
	WiFiAddress       string `json:"wifiAddress,omitempty"`
	BuildVersion      string `json:"buildVersion,omitempty"`
}

type DriverCacheConfig

type DriverCacheConfig struct {
	Platform   string
	Serial     string
	AIOptions  []option.AIServiceOption
	DeviceOpts *option.DeviceOptions // unified device options
}

DriverCacheConfig holds configuration for driver creation

type DriverRawResponse

type DriverRawResponse []byte

func (DriverRawResponse) CheckErr

func (r DriverRawResponse) CheckErr() (err error)

func (DriverRawResponse) ValueConvertToBool

func (r DriverRawResponse) ValueConvertToBool() (b bool, err error)

func (DriverRawResponse) ValueConvertToJsonObject

func (r DriverRawResponse) ValueConvertToJsonObject() (obj map[string]interface{}, err error)

func (DriverRawResponse) ValueConvertToJsonRawMessage

func (r DriverRawResponse) ValueConvertToJsonRawMessage() (raw builtinJSON.RawMessage, err error)

func (DriverRawResponse) ValueConvertToString

func (r DriverRawResponse) ValueConvertToString() (s string, err error)

func (DriverRawResponse) ValueDecodeAsBase64

func (r DriverRawResponse) ValueDecodeAsBase64() (raw *bytes.Buffer, err error)

type DriverRequests

type DriverRequests struct {
	RequestMethod string    `json:"request_method"`
	RequestUrl    string    `json:"request_url"`
	RequestBody   string    `json:"request_body,omitempty"`
	RequestTime   time.Time `json:"request_time"`

	ResponseStatus   int    `json:"response_status"`
	ResponseDuration int64  `json:"response_duration(ms)"` // ms
	ResponseBody     string `json:"response_body"`

	Success bool   `json:"success"`
	Error   string `json:"error,omitempty"`
}

type DriverSession

type DriverSession struct {
	ID string
	// contains filtered or unexported fields
}

func NewDriverSession

func NewDriverSession() *DriverSession

func (*DriverSession) DELETE

func (s *DriverSession) DELETE(urlStr string, opts ...option.ActionOption) (rawResp DriverRawResponse, err error)

func (*DriverSession) GET

func (s *DriverSession) GET(urlStr string, opts ...option.ActionOption) (rawResp DriverRawResponse, err error)

func (*DriverSession) GetData

func (s *DriverSession) GetData(withReset bool) SessionData

func (*DriverSession) History

func (s *DriverSession) History() []*DriverRequests

func (*DriverSession) POST

func (s *DriverSession) POST(data interface{}, urlStr string, opts ...option.ActionOption) (rawResp DriverRawResponse, err error)

func (*DriverSession) RegisterResetHandler

func (s *DriverSession) RegisterResetHandler(fn func() error)

func (*DriverSession) Request

func (s *DriverSession) Request(method string, urlStr string, rawBody []byte, opts ...option.ActionOption) (
	rawResp DriverRawResponse, err error,
)

func (*DriverSession) RequestWithRetry

func (s *DriverSession) RequestWithRetry(method string, urlStr string, rawBody []byte, opts ...option.ActionOption) (
	rawResp DriverRawResponse, err error,
)

func (*DriverSession) Reset

func (s *DriverSession) Reset()

func (*DriverSession) SetBaseURL

func (s *DriverSession) SetBaseURL(baseUrl string)

func (*DriverSession) SetupPortForward

func (s *DriverSession) SetupPortForward(localPort int) error

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(lines []string) (eps []ExportPoint)

type HDCDriver

type HDCDriver struct {
	Device  *HarmonyDevice
	Session *DriverSession
	// contains filtered or unexported fields
}

func NewHDCDriver

func NewHDCDriver(device *HarmonyDevice) (*HDCDriver, error)

func (*HDCDriver) AppClear

func (hd *HDCDriver) AppClear(packageName string) error

func (*HDCDriver) AppLaunch

func (hd *HDCDriver) AppLaunch(packageName string) error

func (*HDCDriver) AppTerminate

func (hd *HDCDriver) AppTerminate(packageName string) (bool, error)

func (*HDCDriver) Back

func (hd *HDCDriver) Back() error

func (*HDCDriver) Backspace

func (hd *HDCDriver) Backspace(count int, opts ...option.ActionOption) (err error)

func (*HDCDriver) BatteryInfo

func (hd *HDCDriver) BatteryInfo() (types.BatteryInfo, error)

func (*HDCDriver) ClearFiles

func (hd *HDCDriver) ClearFiles(paths ...string) error

func (*HDCDriver) ClearImages

func (hd *HDCDriver) ClearImages() error

func (*HDCDriver) DeleteSession

func (hd *HDCDriver) DeleteSession() error

func (*HDCDriver) DeviceInfo

func (hd *HDCDriver) DeviceInfo() (types.DeviceInfo, error)

func (*HDCDriver) DoubleTap

func (hd *HDCDriver) DoubleTap(x, y float64, opts ...option.ActionOption) error

func (*HDCDriver) Drag

func (hd *HDCDriver) Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

func (*HDCDriver) ForegroundInfo

func (hd *HDCDriver) ForegroundInfo() (app types.AppInfo, err error)

func (*HDCDriver) GetDevice

func (hd *HDCDriver) GetDevice() IDevice

func (*HDCDriver) GetPasteboard

func (hd *HDCDriver) GetPasteboard() (content string, err error)

func (*HDCDriver) GetSession

func (hd *HDCDriver) GetSession() *DriverSession

func (*HDCDriver) Home

func (hd *HDCDriver) Home() error

func (*HDCDriver) HoverBySelector

func (hd *HDCDriver) HoverBySelector(selector string, options ...option.ActionOption) (err error)

func (*HDCDriver) InitSession

func (hd *HDCDriver) InitSession(capabilities option.Capabilities) error

func (*HDCDriver) Input

func (hd *HDCDriver) Input(text string, opts ...option.ActionOption) error

func (*HDCDriver) Orientation

func (hd *HDCDriver) Orientation() (orientation types.Orientation, err error)

func (*HDCDriver) PressButton

func (hd *HDCDriver) PressButton(button types.DeviceButton) (err error)

func (*HDCDriver) PressHarmonyKeyCode

func (hd *HDCDriver) PressHarmonyKeyCode(keyCode ghdc.KeyCode) (err error)

func (*HDCDriver) PullFiles

func (hd *HDCDriver) PullFiles(localDir string, remoteDirs ...string) error

func (*HDCDriver) PullImages

func (hd *HDCDriver) PullImages(localDir string) error

func (*HDCDriver) PushFile

func (hd *HDCDriver) PushFile(localPath string, remoteDir string) error

func (*HDCDriver) PushImage

func (hd *HDCDriver) PushImage(localPath string) error

func (*HDCDriver) Rotation

func (hd *HDCDriver) Rotation() (rotation types.Rotation, err error)

func (*HDCDriver) ScreenRecord

func (hd *HDCDriver) ScreenRecord(opts ...option.ActionOption) (videoPath string, err error)

func (*HDCDriver) ScreenShot

func (hd *HDCDriver) ScreenShot(opts ...option.ActionOption) (*bytes.Buffer, error)

func (*HDCDriver) SecondaryClick

func (hd *HDCDriver) SecondaryClick(x, y float64) (err error)

func (*HDCDriver) SecondaryClickBySelector

func (hd *HDCDriver) SecondaryClickBySelector(selector string, options ...option.ActionOption) (err error)

func (*HDCDriver) SetIme

func (hd *HDCDriver) SetIme(ime string) error

func (*HDCDriver) SetRotation

func (hd *HDCDriver) SetRotation(rotation types.Rotation) (err error)

func (*HDCDriver) Setup

func (hd *HDCDriver) Setup() error

func (*HDCDriver) Source

func (hd *HDCDriver) Source(srcOpt ...option.SourceOption) (string, error)

func (*HDCDriver) StartCaptureLog

func (hd *HDCDriver) StartCaptureLog(identifier ...string) (err error)

func (*HDCDriver) Status

func (hd *HDCDriver) Status() (types.DeviceStatus, error)

func (*HDCDriver) StopCaptureLog

func (hd *HDCDriver) StopCaptureLog() (result interface{}, err error)

func (*HDCDriver) Swipe

func (hd *HDCDriver) Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

Swipe works like Drag, but `pressForDuration` value is 0

func (*HDCDriver) TapAbsXY

func (hd *HDCDriver) TapAbsXY(x, y float64, opts ...option.ActionOption) error

func (*HDCDriver) TapBySelector

func (hd *HDCDriver) TapBySelector(text string, opts ...option.ActionOption) error

func (*HDCDriver) TapXY

func (hd *HDCDriver) TapXY(x, y float64, opts ...option.ActionOption) error

func (*HDCDriver) TearDown

func (hd *HDCDriver) TearDown() error

func (*HDCDriver) TouchAndHold

func (hd *HDCDriver) TouchAndHold(x, y float64, opts ...option.ActionOption) (err error)

func (*HDCDriver) Unlock

func (hd *HDCDriver) Unlock() (err error)

func (*HDCDriver) WindowSize

func (hd *HDCDriver) WindowSize() (size types.Size, err error)

type HarmonyDevice

type HarmonyDevice struct {
	*ghdc.Device
	Options *option.HarmonyDeviceOptions
}

func NewHarmonyDevice

func NewHarmonyDevice(opts ...option.HarmonyDeviceOption) (device *HarmonyDevice, err error)

func (*HarmonyDevice) GetPackageInfo

func (dev *HarmonyDevice) GetPackageInfo(packageName string) (types.AppInfo, error)

func (*HarmonyDevice) Install

func (dev *HarmonyDevice) Install(appPath string, opts ...option.InstallOption) error

func (*HarmonyDevice) IsHealthy

func (dev *HarmonyDevice) IsHealthy() (bool, error)

func (*HarmonyDevice) ListPackages

func (dev *HarmonyDevice) ListPackages() ([]string, error)

func (*HarmonyDevice) LogEnabled

func (dev *HarmonyDevice) LogEnabled() bool

func (*HarmonyDevice) NewDriver

func (dev *HarmonyDevice) NewDriver() (IDriver, error)

func (*HarmonyDevice) ScreenShot

func (dev *HarmonyDevice) ScreenShot() (*bytes.Buffer, error)

func (*HarmonyDevice) Setup

func (dev *HarmonyDevice) Setup() error

func (*HarmonyDevice) Teardown

func (dev *HarmonyDevice) Teardown() error

func (*HarmonyDevice) UUID

func (dev *HarmonyDevice) UUID() string

func (*HarmonyDevice) Uninstall

func (dev *HarmonyDevice) Uninstall(packageName string) error

type Hierarchy

type Hierarchy struct {
	XMLName xml.Name `xml:"hierarchy"`
	Attributes
	Layout []Layout `xml:",any"`
}

type IDevice

type IDevice interface {
	UUID() string
	NewDriver() (driver IDriver, err error)

	IsHealthy() (bool, error)

	Setup() error
	Teardown() error

	Install(appPath string, opts ...option.InstallOption) error
	Uninstall(packageName string) error

	ListPackages() ([]string, error)

	GetPackageInfo(packageName string) (types.AppInfo, error)
	ScreenShot() (*bytes.Buffer, error)
	// TODO: remove?
	LogEnabled() bool
}

current implemeted device: IOSDevice, AndroidDevice, HarmonyDevice

func NewDeviceWithDefault

func NewDeviceWithDefault(platform, serial string) (device IDevice, err error)

NewDeviceWithDefault is a helper function to create a device with default options

type IDriver

type IDriver interface {
	GetDevice() IDevice
	Setup() error
	TearDown() error

	// session
	InitSession(capabilities option.Capabilities) error
	GetSession() *DriverSession
	DeleteSession() error

	// device info and status
	Status() (types.DeviceStatus, error)
	DeviceInfo() (types.DeviceInfo, error)
	BatteryInfo() (types.BatteryInfo, error)
	ForegroundInfo() (app types.AppInfo, err error)
	WindowSize() (types.Size, error)
	ScreenShot(opts ...option.ActionOption) (*bytes.Buffer, error)
	ScreenRecord(opts ...option.ActionOption) (videoPath string, err error)
	Source(srcOpt ...option.SourceOption) (string, error)
	Orientation() (orientation types.Orientation, err error)
	Rotation() (rotation types.Rotation, err error)

	// config
	SetRotation(rotation types.Rotation) error
	SetIme(ime string) error

	// actions
	Home() error
	Unlock() error
	Back() error
	PressButton(button types.DeviceButton) error

	// hover
	HoverBySelector(selector string, opts ...option.ActionOption) error
	// tap
	TapXY(x, y float64, opts ...option.ActionOption) error    // by percentage or absolute coordinate
	TapAbsXY(x, y float64, opts ...option.ActionOption) error // by absolute coordinate
	TapBySelector(text string, opts ...option.ActionOption) error
	DoubleTap(x, y float64, opts ...option.ActionOption) error // by absolute coordinate
	TouchAndHold(x, y float64, opts ...option.ActionOption) error
	// secondary click
	SecondaryClick(x, y float64) error
	SecondaryClickBySelector(selector string, options ...option.ActionOption) error
	// swipe
	Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error
	Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error // by percentage
	// input
	Input(text string, opts ...option.ActionOption) error
	Backspace(count int, opts ...option.ActionOption) error

	// app related
	AppLaunch(packageName string) error
	AppTerminate(packageName string) (bool, error)
	AppClear(packageName string) error

	// image related
	PushImage(localPath string) error
	PullImages(localDir string) error
	ClearImages() error

	// files related
	PushFile(localPath string, remoteDir string) error
	PullFiles(localDir string, remoteDirs ...string) error
	ClearFiles(paths ...string) error

	// triggers the log capture and returns the log entries
	StartCaptureLog(identifier ...string) error
	StopCaptureLog() (result interface{}, err error)

	// clipboard operations
	GetPasteboard() (string, error)
}

current implemeted driver: ADBDriver, UIA2Driver, WDADriver, HDCDriver

type IOSDevice

type IOSDevice struct {
	ios.DeviceEntry
	Options *option.IOSDeviceOptions
	// contains filtered or unexported fields
}

func NewIOSDevice

func NewIOSDevice(opts ...option.IOSDeviceOption) (device *IOSDevice, err error)

func (*IOSDevice) AutoMountImage

func (dev *IOSDevice) AutoMountImage(baseDir string) (err error)

func (*IOSDevice) Forward

func (dev *IOSDevice) Forward(remotePort int) (int, error)

func (*IOSDevice) GetAppInfo

func (dev *IOSDevice) GetAppInfo(packageName string) (appInfo installationproxy.AppInfo, err error)

func (*IOSDevice) GetDeviceInfo

func (dev *IOSDevice) GetDeviceInfo() (*DeviceDetail, error)

func (*IOSDevice) GetPackageInfo

func (dev *IOSDevice) GetPackageInfo(packageName string) (types.AppInfo, error)

func (*IOSDevice) Install

func (dev *IOSDevice) Install(appPath string, opts ...option.InstallOption) (err error)

func (*IOSDevice) IsHealthy

func (dev *IOSDevice) IsHealthy() (bool, error)

func (*IOSDevice) ListApps

func (dev *IOSDevice) ListApps(appType ApplicationType) (apps []installationproxy.AppInfo, err error)

func (*IOSDevice) ListImages

func (dev *IOSDevice) ListImages() (images []string, err error)

func (*IOSDevice) ListPackages

func (dev *IOSDevice) ListPackages() ([]string, error)

func (*IOSDevice) ListProcess

func (dev *IOSDevice) ListProcess(applicationsOnly bool) (processList []instruments.ProcessInfo, err error)

func (*IOSDevice) LogEnabled

func (dev *IOSDevice) LogEnabled() bool

func (*IOSDevice) MountImage

func (dev *IOSDevice) MountImage(imagePath string) (err error)

func (*IOSDevice) NewDriver

func (dev *IOSDevice) NewDriver() (driver IDriver, err error)

func (*IOSDevice) Reboot

func (dev *IOSDevice) Reboot() error

func (*IOSDevice) RunXCTest

func (dev *IOSDevice) RunXCTest(ctx context.Context, bundleID, testRunnerBundleID, xctestConfig string) (err error)

func (*IOSDevice) RunXCTestDaemon

func (dev *IOSDevice) RunXCTestDaemon(ctx context.Context, bundleID, testRunnerBundleID, xctestConfig string)

func (*IOSDevice) ScreenShot

func (dev *IOSDevice) ScreenShot() (*bytes.Buffer, error)

func (*IOSDevice) Setup

func (dev *IOSDevice) Setup() error

func (*IOSDevice) Teardown

func (dev *IOSDevice) Teardown() error

func (*IOSDevice) UUID

func (dev *IOSDevice) UUID() string

func (*IOSDevice) Uninstall

func (dev *IOSDevice) Uninstall(bundleId string) error

func (*IOSDevice) UnmountImage

func (dev *IOSDevice) UnmountImage() (err error)

type InstallResult

type InstallResult struct {
	Result    int    `json:"result"`
	ErrorCode int    `json:"errorCode"`
	ErrorMsg  string `json:"errorMsg"`
}

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

	// Navigate to previous key.
	// Goes backward by one item in an ordered collection of items.
	KCNavigatePrevious KeyCode = 260

	// Navigate to next key.
	// Advances to the next item in an ordered collection of items.
	KCNavigateNext KeyCode = 261

	// Navigate in key.
	// Activates the item that currently has focus or expands to the next level of a navigation
	// hierarchy.
	KCNavigateIn KeyCode = 262

	// Navigate out key.
	// 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

	// Consumed by the system for navigation up
	KCSystemNavigationUp KeyCode = 280

	// Consumed by the system for navigation down
	KCSystemNavigationDown KeyCode = 281

	// Consumed by the system for navigation left*/
	KCSystemNavigationLeft KeyCode = 282

	// Consumed by the system for navigation right
	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 KeyMeta

type KeyMeta int
const (
	KMEmpty        KeyMeta = 0        // As a `null`
	KMCapLocked    KeyMeta = 0x100    // SHIFT key locked in CAPS mode.
	KMAltLocked    KeyMeta = 0x200    // ALT key locked.
	KMSymLocked    KeyMeta = 0x400    // SYM key locked.
	KMSelecting    KeyMeta = 0x800    // Text is in selection mode.
	KMAltOn        KeyMeta = 0x02     // This mask is used to check whether one of the ALT meta keys is pressed.
	KMAltLeftOn    KeyMeta = 0x10     // This mask is used to check whether the left ALT meta key is pressed.
	KMAltRightOn   KeyMeta = 0x20     // This mask is used to check whether the right the ALT meta key is pressed.
	KMShiftOn      KeyMeta = 0x1      // This mask is used to check whether one of the SHIFT meta keys is pressed.
	KMShiftLeftOn  KeyMeta = 0x40     // This mask is used to check whether the left SHIFT meta key is pressed.
	KMShiftRightOn KeyMeta = 0x80     // This mask is used to check whether the right SHIFT meta key is pressed.
	KMSymOn        KeyMeta = 0x4      // This mask is used to check whether the SYM meta key is pressed.
	KMFunctionOn   KeyMeta = 0x8      // This mask is used to check whether the FUNCTION meta key is pressed.
	KMCtrlOn       KeyMeta = 0x1000   // This mask is used to check whether one of the CTRL meta keys is pressed.
	KMCtrlLeftOn   KeyMeta = 0x2000   // This mask is used to check whether the left CTRL meta key is pressed.
	KMCtrlRightOn  KeyMeta = 0x4000   // This mask is used to check whether the right CTRL meta key is pressed.
	KMMetaOn       KeyMeta = 0x10000  // This mask is used to check whether one of the META meta keys is pressed.
	KMMetaLeftOn   KeyMeta = 0x20000  // This mask is used to check whether the left META meta key is pressed.
	KMMetaRightOn  KeyMeta = 0x40000  // This mask is used to check whether the right META meta key is pressed.
	KMCapsLockOn   KeyMeta = 0x100000 // This mask is used to check whether the CAPS LOCK meta key is on.
	KMNumLockOn    KeyMeta = 0x200000 // This mask is used to check whether the NUM LOCK meta key is on.
	KMScrollLockOn KeyMeta = 0x400000 // This mask is used to check whether the SCROLL LOCK meta key is on.
	KMShiftMask            = KMShiftOn | KMShiftLeftOn | KMShiftRightOn
	KMAltMask              = KMAltOn | KMAltLeftOn | KMAltRightOn
	KMCtrlMask             = KMCtrlOn | KMCtrlLeftOn | KMCtrlRightOn
	KMMetaMask             = KMMetaOn | KMMetaLeftOn | KMMetaRightOn
)

type Layout

type Layout struct {
	Attributes
	Layout []Layout `xml:",any"`
}

type LineCallback

type LineCallback func(string)

type MCPClient4XTDriver

type MCPClient4XTDriver struct {
	client.MCPClient
	Server *MCPServer4XTDriver
}

MCPClient4XTDriver is a mock MCP client that only implements the methods used by the host

func (*MCPClient4XTDriver) CallTool

func (*MCPClient4XTDriver) Close

func (c *MCPClient4XTDriver) Close() error

func (*MCPClient4XTDriver) GetToolByAction

func (c *MCPClient4XTDriver) GetToolByAction(actionName option.ActionName) ActionTool

GetToolByAction implements ActionToolProvider interface

func (*MCPClient4XTDriver) Initialize

func (*MCPClient4XTDriver) ListTools

type MCPResponse

type MCPResponse struct {
	Action  string `json:"action" desc:"Action performed"`
	Success bool   `json:"success" desc:"Whether the operation was successful"`
	Message string `json:"message" desc:"Human-readable message describing the result"`
}

MCPResponse represents the standard response structure for all MCP tools

type MCPServer4XTDriver

type MCPServer4XTDriver struct {
	// contains filtered or unexported fields
}

MCPServer4XTDriver wraps a MCPServer to expose XTDriver functionality via MCP protocol.

func NewMCPServer

func NewMCPServer() *MCPServer4XTDriver

func (*MCPServer4XTDriver) GetTool

func (s *MCPServer4XTDriver) GetTool(name string) *mcp.Tool

GetTool returns a pointer to the mcp.Tool with the given name

func (*MCPServer4XTDriver) GetToolByAction

func (s *MCPServer4XTDriver) GetToolByAction(actionMethod option.ActionName) ActionTool

GetToolByAction returns the tool that handles the given action method

func (*MCPServer4XTDriver) ListTools

func (s *MCPServer4XTDriver) ListTools() []mcp.Tool

ListTools returns all registered tools

func (*MCPServer4XTDriver) Start

func (s *MCPServer4XTDriver) Start() error

Start runs the MCP server (blocking).

type PlanningExecutionResult

type PlanningExecutionResult struct {
	ai.PlanningResult // Inherit all fields from ai.PlanningResult (ToolCalls, Thought, Content, Error, ModelName)
	// Planning process information
	ScreenshotElapsed int64         `json:"screenshot_elapsed_ms"` // screenshot elapsed time(ms)
	ImagePath         string        `json:"image_path"`            // screenshot image path
	Resolution        *types.Size   `json:"resolution"`            // image resolution
	ScreenResult      *ScreenResult `json:"screen_result"`         // complete screen result data
	ModelCallElapsed  int64         `json:"model_call_elapsed_ms"` // model call elapsed time(ms)
	ToolCallsCount    int           `json:"tool_calls_count"`      // number of tool calls generated
	ActionNames       []string      `json:"action_names"`          // names of parsed actions
	// Execution information
	StartTime  int64              `json:"start_time"`            // planning start time
	Elapsed    int64              `json:"elapsed_ms"`            // planning elapsed time(ms)
	SubActions []*SubActionResult `json:"sub_actions,omitempty"` // sub-actions generated from this planning
}

PlanningExecutionResult represents a unified planning result that contains both planning information and execution results

type PopupInfo

type PopupInfo struct {
	*ai.ClosePopupsResult
	ClosePoints []ai.PointF `json:"close_points,omitempty"` // CV 识别的所有关闭按钮(仅关闭按钮,可能存在多个)
	PicName     string      `json:"pic_name"`
	PicURL      string      `json:"pic_url"`
}

func (*PopupInfo) ClosePoint

func (p *PopupInfo) ClosePoint() *ai.PointF

type PowerStatus

type PowerStatus string
const (
	POWER_STATUS_SUSPEND PowerStatus = "POWER_STATUS_SUSPEND"
	POWER_STATUS_OFF     PowerStatus = "POWER_STATUS_OFF"
	POWER_STATUS_ON      PowerStatus = "POWER_STATUS_ON"
)

type SIMSupport

type SIMSupport interface {
	SIMClickAtPoint(x, y float64, opts ...option.ActionOption) error
	SIMSwipeWithDirection(direction string, fromX, fromY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error
	SIMSwipeInArea(direction string, simAreaStartX, simAreaStartY, simAreaEndX, simAreaEndY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error
	SIMSwipeFromPointToPoint(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error
	SIMInput(text string, opts ...option.ActionOption) error
}

SIMSupport interface defines simulated interaction methods Any driver that supports simulated touch and input should implement this interface

type Screen

type Screen struct {
	types.Size
	Scale float64 `json:"scale"`
}

type ScreenResult

type ScreenResult struct {
	ImagePath   string         `json:"image_path"` // image file path
	Resolution  types.Size     `json:"resolution"`
	UploadedURL string         `json:"uploaded_url"` // uploaded image url
	Texts       ai.OCRTexts    `json:"texts"`        // dumped raw OCRTexts
	Icons       ai.UIResultMap `json:"icons"`        // CV 识别的图标
	Tags        []string       `json:"tags"`         // tags for image, e.g. ["feed", "ad", "live"]
	Popup       *PopupInfo     `json:"popup,omitempty"`
	Elapsed     int64          `json:"elapsed_ms,omitempty"` // screenshot elapsed time in milliseconds
	Base64      string         `json:"-"`                    // base64 encoded screenshot
	// contains filtered or unexported fields
}

ScreenResult represents the result of taking a screenshot, including image path, recognition results, and metadata

func (*ScreenResult) FilterTextsByScope

func (s *ScreenResult) FilterTextsByScope(x1, y1, x2, y2 float64) ai.OCRTexts

type SessionData

type SessionData struct {
	Requests      []*DriverRequests `json:"requests,omitempty"`       // store sub-action specific requests
	ScreenResults []*ScreenResult   `json:"screen_results,omitempty"` // store sub-action specific screen_results
}

type SleepConfig

type SleepConfig struct {
	StartTime    time.Time `json:"start_time"`
	Seconds      float64   `json:"seconds,omitempty"`
	Milliseconds int64     `json:"milliseconds,omitempty"`
}

type SubActionResult

type SubActionResult struct {
	ActionName string      `json:"action_name"`         // name of the sub-action (e.g., "tap", "input")
	Arguments  interface{} `json:"arguments,omitempty"` // arguments passed to the sub-action
	StartTime  int64       `json:"start_time"`          // sub-action start time
	Elapsed    int64       `json:"elapsed_ms"`          // sub-action elapsed time(ms)
	Error      string      `json:"error,omitempty"`     // sub-action execution result
	SessionData
}

SubActionResult represents a sub-action within a start_to_goal action

type ToolAIAction

type ToolAIAction struct {
	// Return data fields - these define the structure of data returned by this tool
	Prompt string `json:"prompt" desc:"AI action prompt that was executed"`
}

ToolAIAction implements the ai_action tool call.

func (*ToolAIAction) ConvertActionToCallToolRequest

func (t *ToolAIAction) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolAIAction) Description

func (t *ToolAIAction) Description() string

func (*ToolAIAction) Implement

func (t *ToolAIAction) Implement() server.ToolHandlerFunc

func (*ToolAIAction) Name

func (t *ToolAIAction) Name() option.ActionName

func (*ToolAIAction) Options

func (t *ToolAIAction) Options() []mcp.ToolOption

type ToolAIQuery

type ToolAIQuery struct {
	// Return data fields - these define the structure of data returned by this tool
	Prompt string `json:"prompt" desc:"AI query prompt that was executed"`
	Result string `json:"result" desc:"Query result content"`
}

ToolAIQuery implements the ai_query tool call.

func (*ToolAIQuery) ConvertActionToCallToolRequest

func (t *ToolAIQuery) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolAIQuery) Description

func (t *ToolAIQuery) Description() string

func (*ToolAIQuery) Implement

func (t *ToolAIQuery) Implement() server.ToolHandlerFunc

func (*ToolAIQuery) Name

func (t *ToolAIQuery) Name() option.ActionName

func (*ToolAIQuery) Options

func (t *ToolAIQuery) Options() []mcp.ToolOption

type ToolAppClear

type ToolAppClear struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name of the app whose data was cleared"`
}

ToolAppClear implements the app_clear tool call.

func (*ToolAppClear) ConvertActionToCallToolRequest

func (t *ToolAppClear) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolAppClear) Description

func (t *ToolAppClear) Description() string

func (*ToolAppClear) Implement

func (t *ToolAppClear) Implement() server.ToolHandlerFunc

func (*ToolAppClear) Name

func (t *ToolAppClear) Name() option.ActionName

func (*ToolAppClear) Options

func (t *ToolAppClear) Options() []mcp.ToolOption

type ToolAppInstall

type ToolAppInstall struct {
	// Return data fields - these define the structure of data returned by this tool
	Path string `json:"path" desc:"Path or URL of the installed app"`
}

ToolAppInstall implements the app_install tool call.

func (*ToolAppInstall) ConvertActionToCallToolRequest

func (t *ToolAppInstall) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolAppInstall) Description

func (t *ToolAppInstall) Description() string

func (*ToolAppInstall) Implement

func (t *ToolAppInstall) Implement() server.ToolHandlerFunc

func (*ToolAppInstall) Name

func (t *ToolAppInstall) Name() option.ActionName

func (*ToolAppInstall) Options

func (t *ToolAppInstall) Options() []mcp.ToolOption

type ToolAppUninstall

type ToolAppUninstall struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name of the uninstalled app"`
}

ToolAppUninstall implements the app_uninstall tool call.

func (*ToolAppUninstall) ConvertActionToCallToolRequest

func (t *ToolAppUninstall) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolAppUninstall) Description

func (t *ToolAppUninstall) Description() string

func (*ToolAppUninstall) Implement

func (t *ToolAppUninstall) Implement() server.ToolHandlerFunc

func (*ToolAppUninstall) Name

func (*ToolAppUninstall) Options

func (t *ToolAppUninstall) Options() []mcp.ToolOption

type ToolBack

type ToolBack struct {
}

ToolBack implements the back tool call.

func (*ToolBack) ConvertActionToCallToolRequest

func (t *ToolBack) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolBack) Description

func (t *ToolBack) Description() string

func (*ToolBack) Implement

func (t *ToolBack) Implement() server.ToolHandlerFunc

func (*ToolBack) Name

func (t *ToolBack) Name() option.ActionName

func (*ToolBack) Options

func (t *ToolBack) Options() []mcp.ToolOption

type ToolBackspace

type ToolBackspace struct {
	// Return data fields - these define the structure of data returned by this tool
	Count int `json:"count" desc:"Number of backspace operations performed"`
}

ToolBackspace implements the backspace tool call.

func (*ToolBackspace) ConvertActionToCallToolRequest

func (t *ToolBackspace) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolBackspace) Description

func (t *ToolBackspace) Description() string

func (*ToolBackspace) Implement

func (t *ToolBackspace) Implement() server.ToolHandlerFunc

func (*ToolBackspace) Name

func (t *ToolBackspace) Name() option.ActionName

func (*ToolBackspace) Options

func (t *ToolBackspace) Options() []mcp.ToolOption

type ToolClearAlbums

type ToolClearAlbums struct {
	// Return data fields - these define the structure of data returned by this tool
	Cleared bool `json:"cleared" desc:"Whether albums were cleared successfully"`
}

ToolClearAlbums implements the clear_albums tool call.

func (*ToolClearAlbums) ConvertActionToCallToolRequest

func (t *ToolClearAlbums) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolClearAlbums) Description

func (t *ToolClearAlbums) Description() string

func (*ToolClearAlbums) Implement

func (t *ToolClearAlbums) Implement() server.ToolHandlerFunc

func (*ToolClearAlbums) Name

func (t *ToolClearAlbums) Name() option.ActionName

func (*ToolClearAlbums) Options

func (t *ToolClearAlbums) Options() []mcp.ToolOption

type ToolClosePopups

type ToolClosePopups struct {
}

ToolClosePopups implements the close_popups tool call.

func (*ToolClosePopups) ConvertActionToCallToolRequest

func (t *ToolClosePopups) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolClosePopups) Description

func (t *ToolClosePopups) Description() string

func (*ToolClosePopups) Implement

func (t *ToolClosePopups) Implement() server.ToolHandlerFunc

func (*ToolClosePopups) Name

func (t *ToolClosePopups) Name() option.ActionName

func (*ToolClosePopups) Options

func (t *ToolClosePopups) Options() []mcp.ToolOption

type ToolColdLaunch

type ToolColdLaunch struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name of the cold launched app"`
}

ToolColdLaunch implements the cold_launch tool call.

func (*ToolColdLaunch) ConvertActionToCallToolRequest

func (t *ToolColdLaunch) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolColdLaunch) Description

func (t *ToolColdLaunch) Description() string

func (*ToolColdLaunch) Implement

func (t *ToolColdLaunch) Implement() server.ToolHandlerFunc

func (*ToolColdLaunch) Name

func (t *ToolColdLaunch) Name() option.ActionName

func (*ToolColdLaunch) Options

func (t *ToolColdLaunch) Options() []mcp.ToolOption

type ToolDoubleTapXY

type ToolDoubleTapXY struct {
	// Return data fields - these define the structure of data returned by this tool
	X float64 `json:"x" desc:"X coordinate where double tap was performed"`
	Y float64 `json:"y" desc:"Y coordinate where double tap was performed"`
}

ToolDoubleTapXY implements the double_tap_xy tool call.

func (*ToolDoubleTapXY) ConvertActionToCallToolRequest

func (t *ToolDoubleTapXY) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolDoubleTapXY) Description

func (t *ToolDoubleTapXY) Description() string

func (*ToolDoubleTapXY) Implement

func (t *ToolDoubleTapXY) Implement() server.ToolHandlerFunc

func (*ToolDoubleTapXY) Name

func (t *ToolDoubleTapXY) Name() option.ActionName

func (*ToolDoubleTapXY) Options

func (t *ToolDoubleTapXY) Options() []mcp.ToolOption

type ToolDrag

type ToolDrag struct {
	// Return data fields - these define the structure of data returned by this tool
	FromX float64 `json:"fromX" desc:"Starting X coordinate of the drag"`
	FromY float64 `json:"fromY" desc:"Starting Y coordinate of the drag"`
	ToX   float64 `json:"toX" desc:"Ending X coordinate of the drag"`
	ToY   float64 `json:"toY" desc:"Ending Y coordinate of the drag"`
}

ToolDrag implements the drag tool call.

func (*ToolDrag) ConvertActionToCallToolRequest

func (t *ToolDrag) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolDrag) Description

func (t *ToolDrag) Description() string

func (*ToolDrag) Implement

func (t *ToolDrag) Implement() server.ToolHandlerFunc

func (*ToolDrag) Name

func (t *ToolDrag) Name() option.ActionName

func (*ToolDrag) Options

func (t *ToolDrag) Options() []mcp.ToolOption

type ToolFinished

type ToolFinished struct {
	// Return data fields - these define the structure of data returned by this tool
	Content string `json:"content" desc:"Task completion reason or result message"`
}

ToolFinished implements the finished tool call.

func (*ToolFinished) ConvertActionToCallToolRequest

func (t *ToolFinished) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolFinished) Description

func (t *ToolFinished) Description() string

func (*ToolFinished) Implement

func (t *ToolFinished) Implement() server.ToolHandlerFunc

func (*ToolFinished) Name

func (t *ToolFinished) Name() option.ActionName

func (*ToolFinished) Options

func (t *ToolFinished) Options() []mcp.ToolOption

type ToolGetForegroundApp

type ToolGetForegroundApp struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name of the foreground app"`
	AppName     string `json:"appName" desc:"Name of the foreground app"`
}

ToolGetForegroundApp implements the get_foreground_app tool call.

func (*ToolGetForegroundApp) ConvertActionToCallToolRequest

func (t *ToolGetForegroundApp) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolGetForegroundApp) Description

func (t *ToolGetForegroundApp) Description() string

func (*ToolGetForegroundApp) Implement

func (*ToolGetForegroundApp) Name

func (*ToolGetForegroundApp) Options

func (t *ToolGetForegroundApp) Options() []mcp.ToolOption

type ToolGetPasteboard

type ToolGetPasteboard struct {
	// Return data fields - these define the structure of data returned by this tool
	Content string `json:"content" desc:"Clipboard content that was retrieved"`
}

ToolGetPasteboard implements the get_pasteboard tool call.

func (*ToolGetPasteboard) ConvertActionToCallToolRequest

func (t *ToolGetPasteboard) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolGetPasteboard) Description

func (t *ToolGetPasteboard) Description() string

func (*ToolGetPasteboard) Implement

func (t *ToolGetPasteboard) Implement() server.ToolHandlerFunc

func (*ToolGetPasteboard) Name

func (*ToolGetPasteboard) Options

func (t *ToolGetPasteboard) Options() []mcp.ToolOption

type ToolGetScreenSize

type ToolGetScreenSize struct {
	// Return data fields - these define the structure of data returned by this tool
	Width  int `json:"width" desc:"Screen width in pixels"`
	Height int `json:"height" desc:"Screen height in pixels"`
}

ToolGetScreenSize implements the get_screen_size tool call.

func (*ToolGetScreenSize) ConvertActionToCallToolRequest

func (t *ToolGetScreenSize) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolGetScreenSize) Description

func (t *ToolGetScreenSize) Description() string

func (*ToolGetScreenSize) Implement

func (t *ToolGetScreenSize) Implement() server.ToolHandlerFunc

func (*ToolGetScreenSize) Name

func (*ToolGetScreenSize) Options

func (t *ToolGetScreenSize) Options() []mcp.ToolOption

type ToolGetSource

type ToolGetSource struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name of the app whose source was retrieved"`
	Source      string `json:"source" desc:"UI hierarchy/source tree data in XML or JSON format"`
}

ToolGetSource implements the get_source tool call.

func (*ToolGetSource) ConvertActionToCallToolRequest

func (t *ToolGetSource) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolGetSource) Description

func (t *ToolGetSource) Description() string

func (*ToolGetSource) Implement

func (t *ToolGetSource) Implement() server.ToolHandlerFunc

func (*ToolGetSource) Name

func (t *ToolGetSource) Name() option.ActionName

func (*ToolGetSource) Options

func (t *ToolGetSource) Options() []mcp.ToolOption

type ToolHome

type ToolHome struct {
}

ToolHome implements the home tool call.

func (*ToolHome) ConvertActionToCallToolRequest

func (t *ToolHome) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolHome) Description

func (t *ToolHome) Description() string

func (*ToolHome) Implement

func (t *ToolHome) Implement() server.ToolHandlerFunc

func (*ToolHome) Name

func (t *ToolHome) Name() option.ActionName

func (*ToolHome) Options

func (t *ToolHome) Options() []mcp.ToolOption

type ToolHoverBySelector

type ToolHoverBySelector struct {
	// Return data fields - these define the structure of data returned by this tool
	Selector string `json:"selector" desc:"CSS selector or XPath used for hover"`
}

ToolHoverBySelector implements the hover_by_selector tool call.

func (*ToolHoverBySelector) ConvertActionToCallToolRequest

func (t *ToolHoverBySelector) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolHoverBySelector) Description

func (t *ToolHoverBySelector) Description() string

func (*ToolHoverBySelector) Implement

func (*ToolHoverBySelector) Name

func (*ToolHoverBySelector) Options

func (t *ToolHoverBySelector) Options() []mcp.ToolOption

type ToolInput

type ToolInput struct {
	// Return data fields - these define the structure of data returned by this tool
	Text string `json:"text" desc:"Text that was input"`
}

ToolInput implements the input tool call.

func (*ToolInput) ConvertActionToCallToolRequest

func (t *ToolInput) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolInput) Description

func (t *ToolInput) Description() string

func (*ToolInput) Implement

func (t *ToolInput) Implement() server.ToolHandlerFunc

func (*ToolInput) Name

func (t *ToolInput) Name() option.ActionName

func (*ToolInput) Options

func (t *ToolInput) Options() []mcp.ToolOption

type ToolLaunchApp

type ToolLaunchApp struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name of the launched app"`
}

ToolLaunchApp implements the launch_app tool call.

func (*ToolLaunchApp) ConvertActionToCallToolRequest

func (t *ToolLaunchApp) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolLaunchApp) Description

func (t *ToolLaunchApp) Description() string

func (*ToolLaunchApp) Implement

func (t *ToolLaunchApp) Implement() server.ToolHandlerFunc

func (*ToolLaunchApp) Name

func (t *ToolLaunchApp) Name() option.ActionName

func (*ToolLaunchApp) Options

func (t *ToolLaunchApp) Options() []mcp.ToolOption

type ToolListAvailableDevices

type ToolListAvailableDevices struct {
	// Return data fields - these define the structure of data returned by this tool
	AndroidDevices []string `json:"androidDevices" desc:"List of Android device serial numbers"`
	IosDevices     []string `json:"iosDevices" desc:"List of iOS device UDIDs"`
	TotalCount     int      `json:"totalCount" desc:"Total number of available devices"`
	AndroidCount   int      `json:"androidCount" desc:"Number of Android devices"`
	IosCount       int      `json:"iosCount" desc:"Number of iOS devices"`
}

ToolListAvailableDevices implements the list_available_devices tool call.

func (*ToolListAvailableDevices) ConvertActionToCallToolRequest

func (t *ToolListAvailableDevices) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolListAvailableDevices) Description

func (t *ToolListAvailableDevices) Description() string

func (*ToolListAvailableDevices) Implement

func (*ToolListAvailableDevices) Name

func (*ToolListAvailableDevices) Options

func (t *ToolListAvailableDevices) Options() []mcp.ToolOption

type ToolListPackages

type ToolListPackages struct {
	// Return data fields - these define the structure of data returned by this tool
	Packages []string `json:"packages" desc:"List of installed app package names on the device"`
	Count    int      `json:"count" desc:"Number of installed packages"`
}

ToolListPackages implements the list_packages tool call.

func (*ToolListPackages) ConvertActionToCallToolRequest

func (t *ToolListPackages) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolListPackages) Description

func (t *ToolListPackages) Description() string

func (*ToolListPackages) Implement

func (t *ToolListPackages) Implement() server.ToolHandlerFunc

func (*ToolListPackages) Name

func (*ToolListPackages) Options

func (t *ToolListPackages) Options() []mcp.ToolOption

type ToolPressButton

type ToolPressButton struct {
	// Return data fields - these define the structure of data returned by this tool
	Button string `json:"button" desc:"Name of the button that was pressed"`
}

ToolPressButton implements the press_button tool call.

func (*ToolPressButton) ConvertActionToCallToolRequest

func (t *ToolPressButton) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolPressButton) Description

func (t *ToolPressButton) Description() string

func (*ToolPressButton) Implement

func (t *ToolPressButton) Implement() server.ToolHandlerFunc

func (*ToolPressButton) Name

func (t *ToolPressButton) Name() option.ActionName

func (*ToolPressButton) Options

func (t *ToolPressButton) Options() []mcp.ToolOption

type ToolPushAlbums

type ToolPushAlbums struct {
	// Return data fields - these define the structure of data returned by this tool
	FilePath string `json:"filePath" desc:"Path of the file that was pushed"`
	FileUrl  string `json:"fileUrl,omitempty" desc:"URL of the file that was downloaded and pushed (if applicable)"`
	FileType string `json:"fileType" desc:"Type of the file that was pushed (image or video)"`
	Cleared  bool   `json:"cleared,omitempty" desc:"Whether albums were cleared before pushing (if applicable)"`
}

ToolPushAlbums implements the push_albums tool call.

func (*ToolPushAlbums) ConvertActionToCallToolRequest

func (t *ToolPushAlbums) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolPushAlbums) Description

func (t *ToolPushAlbums) Description() string

func (*ToolPushAlbums) Implement

func (t *ToolPushAlbums) Implement() server.ToolHandlerFunc

func (*ToolPushAlbums) Name

func (t *ToolPushAlbums) Name() option.ActionName

func (*ToolPushAlbums) Options

func (t *ToolPushAlbums) Options() []mcp.ToolOption

type ToolSIMClickAtPoint

type ToolSIMClickAtPoint struct {
	// Return data fields - these define the structure of data returned by this tool
	X float64 `json:"x" desc:"X coordinate where simulated click was performed"`
	Y float64 `json:"y" desc:"Y coordinate where simulated click was performed"`
}

ToolSIMClickAtPoint implements the sim_click_at_point tool call.

func (*ToolSIMClickAtPoint) ConvertActionToCallToolRequest

func (t *ToolSIMClickAtPoint) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSIMClickAtPoint) Description

func (t *ToolSIMClickAtPoint) Description() string

func (*ToolSIMClickAtPoint) Implement

func (*ToolSIMClickAtPoint) Name

func (*ToolSIMClickAtPoint) Options

func (t *ToolSIMClickAtPoint) Options() []mcp.ToolOption

type ToolSIMInput

type ToolSIMInput struct {
	// Return data fields - these define the structure of data returned by this tool
	Text     string `json:"text" desc:"Text that was input with simulation"`
	Segments int    `json:"segments" desc:"Number of segments the text was split into"`
}

ToolSIMInput implements the sim_input tool call.

func (*ToolSIMInput) ConvertActionToCallToolRequest

func (t *ToolSIMInput) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSIMInput) Description

func (t *ToolSIMInput) Description() string

func (*ToolSIMInput) Implement

func (t *ToolSIMInput) Implement() server.ToolHandlerFunc

func (*ToolSIMInput) Name

func (t *ToolSIMInput) Name() option.ActionName

func (*ToolSIMInput) Options

func (t *ToolSIMInput) Options() []mcp.ToolOption

type ToolSIMSwipeDirection

type ToolSIMSwipeDirection struct {
	// Return data fields - these define the structure of data returned by this tool
	Direction      string  `json:"direction" desc:"Direction that was swiped (up/down/left/right)"`
	StartX         float64 `json:"startX" desc:"Starting X coordinate of the simulated swipe"`
	StartY         float64 `json:"startY" desc:"Starting Y coordinate of the simulated swipe"`
	MinDistance    float64 `json:"minDistance" desc:"Minimum distance of the simulated swipe"`
	MaxDistance    float64 `json:"maxDistance" desc:"Maximum distance of the simulated swipe"`
	ActualDistance float64 `json:"actualDistance" desc:"Actual distance of the simulated swipe"`
}

ToolSIMSwipeDirection implements the sim_swipe_direction tool call.

func (*ToolSIMSwipeDirection) ConvertActionToCallToolRequest

func (t *ToolSIMSwipeDirection) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSIMSwipeDirection) Description

func (t *ToolSIMSwipeDirection) Description() string

func (*ToolSIMSwipeDirection) Implement

func (*ToolSIMSwipeDirection) Name

func (*ToolSIMSwipeDirection) Options

func (t *ToolSIMSwipeDirection) Options() []mcp.ToolOption

type ToolSIMSwipeFromPointToPoint

type ToolSIMSwipeFromPointToPoint struct {
	// Return data fields - these define the structure of data returned by this tool
	StartX float64 `json:"startX" desc:"Starting X coordinate"`
	StartY float64 `json:"startY" desc:"Starting Y coordinate"`
	EndX   float64 `json:"endX" desc:"Ending X coordinate"`
	EndY   float64 `json:"endY" desc:"Ending Y coordinate"`
}

ToolSIMSwipeFromPointToPoint implements the sim_swipe_point_to_point tool call.

func (*ToolSIMSwipeFromPointToPoint) ConvertActionToCallToolRequest

func (t *ToolSIMSwipeFromPointToPoint) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSIMSwipeFromPointToPoint) Description

func (t *ToolSIMSwipeFromPointToPoint) Description() string

func (*ToolSIMSwipeFromPointToPoint) Implement

func (*ToolSIMSwipeFromPointToPoint) Name

func (*ToolSIMSwipeFromPointToPoint) Options

type ToolSIMSwipeInArea

type ToolSIMSwipeInArea struct {
	// Return data fields - these define the structure of data returned by this tool
	Direction   string  `json:"direction" desc:"Direction that was swiped (up/down/left/right)"`
	AreaStartX  float64 `json:"areaStartX" desc:"Area starting X coordinate"`
	AreaStartY  float64 `json:"areaStartY" desc:"Area starting Y coordinate"`
	AreaEndX    float64 `json:"areaEndX" desc:"Area ending X coordinate"`
	AreaEndY    float64 `json:"areaEndY" desc:"Area ending Y coordinate"`
	MinDistance float64 `json:"minDistance" desc:"Minimum distance of the simulated swipe"`
	MaxDistance float64 `json:"maxDistance" desc:"Maximum distance of the simulated swipe"`
}

ToolSIMSwipeInArea implements the sim_swipe_in_area tool call.

func (*ToolSIMSwipeInArea) ConvertActionToCallToolRequest

func (t *ToolSIMSwipeInArea) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSIMSwipeInArea) Description

func (t *ToolSIMSwipeInArea) Description() string

func (*ToolSIMSwipeInArea) Implement

func (t *ToolSIMSwipeInArea) Implement() server.ToolHandlerFunc

func (*ToolSIMSwipeInArea) Name

func (*ToolSIMSwipeInArea) Options

func (t *ToolSIMSwipeInArea) Options() []mcp.ToolOption

type ToolScreenRecord

type ToolScreenRecord struct {
	// Return data fields - these define the structure of data returned by this tool
	VideoPath string  `json:"videoPath" desc:"Path to the recorded video file"`
	Duration  float64 `json:"duration" desc:"Duration of the recording in seconds"`
	Method    string  `json:"method" desc:"Recording method used (adb or scrcpy)"`
}

ToolScreenRecord implements the screenrecord tool call.

func (*ToolScreenRecord) ConvertActionToCallToolRequest

func (t *ToolScreenRecord) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolScreenRecord) Description

func (t *ToolScreenRecord) Description() string

func (*ToolScreenRecord) Implement

func (t *ToolScreenRecord) Implement() server.ToolHandlerFunc

func (*ToolScreenRecord) Name

func (*ToolScreenRecord) Options

func (t *ToolScreenRecord) Options() []mcp.ToolOption

type ToolScreenShot

type ToolScreenShot struct {
}

ToolScreenShot implements the screenshot tool call.

func (*ToolScreenShot) ConvertActionToCallToolRequest

func (t *ToolScreenShot) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolScreenShot) Description

func (t *ToolScreenShot) Description() string

func (*ToolScreenShot) Implement

func (t *ToolScreenShot) Implement() server.ToolHandlerFunc

func (*ToolScreenShot) Name

func (t *ToolScreenShot) Name() option.ActionName

func (*ToolScreenShot) Options

func (t *ToolScreenShot) Options() []mcp.ToolOption

type ToolSecondaryClick

type ToolSecondaryClick struct {
	// Return data fields - these define the structure of data returned by this tool
	X float64 `json:"x" desc:"X coordinate of the secondary click"`
	Y float64 `json:"y" desc:"Y coordinate of the secondary click"`
}

ToolSecondaryClick implements the secondary_click tool call.

func (*ToolSecondaryClick) ConvertActionToCallToolRequest

func (t *ToolSecondaryClick) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSecondaryClick) Description

func (t *ToolSecondaryClick) Description() string

func (*ToolSecondaryClick) Implement

func (t *ToolSecondaryClick) Implement() server.ToolHandlerFunc

func (*ToolSecondaryClick) Name

func (*ToolSecondaryClick) Options

func (t *ToolSecondaryClick) Options() []mcp.ToolOption

type ToolSecondaryClickBySelector

type ToolSecondaryClickBySelector struct {
	// Return data fields - these define the structure of data returned by this tool
	Selector string `json:"selector" desc:"CSS selector or XPath used for secondary click"`
}

ToolSecondaryClickBySelector implements the secondary_click_by_selector tool call.

func (*ToolSecondaryClickBySelector) ConvertActionToCallToolRequest

func (t *ToolSecondaryClickBySelector) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSecondaryClickBySelector) Description

func (t *ToolSecondaryClickBySelector) Description() string

func (*ToolSecondaryClickBySelector) Implement

func (*ToolSecondaryClickBySelector) Name

func (*ToolSecondaryClickBySelector) Options

type ToolSelectDevice

type ToolSelectDevice struct {
	// Return data fields - these define the structure of data returned by this tool
	DeviceUUID string `json:"deviceUUID" desc:"UUID of the selected device"`
}

ToolSelectDevice implements the select_device tool call.

func (*ToolSelectDevice) ConvertActionToCallToolRequest

func (t *ToolSelectDevice) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSelectDevice) Description

func (t *ToolSelectDevice) Description() string

func (*ToolSelectDevice) Implement

func (t *ToolSelectDevice) Implement() server.ToolHandlerFunc

func (*ToolSelectDevice) Name

func (*ToolSelectDevice) Options

func (t *ToolSelectDevice) Options() []mcp.ToolOption

type ToolSetIme

type ToolSetIme struct {
	// Return data fields - these define the structure of data returned by this tool
	Ime string `json:"ime" desc:"IME that was set"`
}

ToolSetIme implements the set_ime tool call.

func (*ToolSetIme) ConvertActionToCallToolRequest

func (t *ToolSetIme) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSetIme) Description

func (t *ToolSetIme) Description() string

func (*ToolSetIme) Implement

func (t *ToolSetIme) Implement() server.ToolHandlerFunc

func (*ToolSetIme) Name

func (t *ToolSetIme) Name() option.ActionName

func (*ToolSetIme) Options

func (t *ToolSetIme) Options() []mcp.ToolOption

type ToolSleep

type ToolSleep struct {
	// Return data fields - these define the structure of data returned by this tool
	Seconds  float64 `json:"seconds" desc:"Duration in seconds that was slept"`
	Duration string  `json:"duration" desc:"Human-readable duration string"`
}

func (*ToolSleep) ConvertActionToCallToolRequest

func (t *ToolSleep) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSleep) Description

func (t *ToolSleep) Description() string

func (*ToolSleep) Implement

func (t *ToolSleep) Implement() server.ToolHandlerFunc

func (*ToolSleep) Name

func (t *ToolSleep) Name() option.ActionName

func (*ToolSleep) Options

func (t *ToolSleep) Options() []mcp.ToolOption

type ToolSleepMS

type ToolSleepMS struct {
	// Return data fields - these define the structure of data returned by this tool
	Milliseconds int64  `json:"milliseconds" desc:"Duration in milliseconds that was slept"`
	Duration     string `json:"duration" desc:"Human-readable duration string"`
}

ToolSleepMS implements the sleep_ms tool call.

func (*ToolSleepMS) ConvertActionToCallToolRequest

func (t *ToolSleepMS) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSleepMS) Description

func (t *ToolSleepMS) Description() string

func (*ToolSleepMS) Implement

func (t *ToolSleepMS) Implement() server.ToolHandlerFunc

func (*ToolSleepMS) Name

func (t *ToolSleepMS) Name() option.ActionName

func (*ToolSleepMS) Options

func (t *ToolSleepMS) Options() []mcp.ToolOption

type ToolSleepRandom

type ToolSleepRandom struct {
	// Return data fields - these define the structure of data returned by this tool
	Params []float64 `json:"params" desc:"Random sleep parameters used"`
}

ToolSleepRandom implements the sleep_random tool call.

func (*ToolSleepRandom) ConvertActionToCallToolRequest

func (t *ToolSleepRandom) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSleepRandom) Description

func (t *ToolSleepRandom) Description() string

func (*ToolSleepRandom) Implement

func (t *ToolSleepRandom) Implement() server.ToolHandlerFunc

func (*ToolSleepRandom) Name

func (t *ToolSleepRandom) Name() option.ActionName

func (*ToolSleepRandom) Options

func (t *ToolSleepRandom) Options() []mcp.ToolOption

type ToolStartToGoal

type ToolStartToGoal struct {
	// Return data fields - these define the structure of data returned by this tool
	Prompt string `json:"prompt" desc:"Goal prompt that was executed"`
}

ToolStartToGoal implements the start_to_goal tool call.

func (*ToolStartToGoal) ConvertActionToCallToolRequest

func (t *ToolStartToGoal) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolStartToGoal) Description

func (t *ToolStartToGoal) Description() string

func (*ToolStartToGoal) Implement

func (t *ToolStartToGoal) Implement() server.ToolHandlerFunc

func (*ToolStartToGoal) Name

func (t *ToolStartToGoal) Name() option.ActionName

func (*ToolStartToGoal) Options

func (t *ToolStartToGoal) Options() []mcp.ToolOption

type ToolSwipe

type ToolSwipe struct {
	// Return data fields - these define the structure of data returned by this tool
	SwipeType string `json:"swipeType" desc:"Type of swipe performed (direction or coordinate)"`
}

ToolSwipe implements the generic swipe tool call. It automatically determines whether to use direction-based or coordinate-based swipe based on the params type.

func (*ToolSwipe) ConvertActionToCallToolRequest

func (t *ToolSwipe) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSwipe) Description

func (t *ToolSwipe) Description() string

func (*ToolSwipe) Implement

func (t *ToolSwipe) Implement() server.ToolHandlerFunc

func (*ToolSwipe) Name

func (t *ToolSwipe) Name() option.ActionName

func (*ToolSwipe) Options

func (t *ToolSwipe) Options() []mcp.ToolOption

type ToolSwipeCoordinate

type ToolSwipeCoordinate struct {
	// Return data fields - these define the structure of data returned by this tool
	FromX float64 `json:"fromX" desc:"Starting X coordinate of the swipe"`
	FromY float64 `json:"fromY" desc:"Starting Y coordinate of the swipe"`
	ToX   float64 `json:"toX" desc:"Ending X coordinate of the swipe"`
	ToY   float64 `json:"toY" desc:"Ending Y coordinate of the swipe"`
}

ToolSwipeCoordinate implements the swipe_coordinate tool call.

func (*ToolSwipeCoordinate) ConvertActionToCallToolRequest

func (t *ToolSwipeCoordinate) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSwipeCoordinate) Description

func (t *ToolSwipeCoordinate) Description() string

func (*ToolSwipeCoordinate) Implement

func (*ToolSwipeCoordinate) Name

func (*ToolSwipeCoordinate) Options

func (t *ToolSwipeCoordinate) Options() []mcp.ToolOption

type ToolSwipeDirection

type ToolSwipeDirection struct {
	// Return data fields - these define the structure of data returned by this tool
	Direction string  `json:"direction" desc:"Direction that was swiped (up/down/left/right)"`
	FromX     float64 `json:"fromX" desc:"Starting X coordinate of the swipe"`
	FromY     float64 `json:"fromY" desc:"Starting Y coordinate of the swipe"`
	ToX       float64 `json:"toX" desc:"Ending X coordinate of the swipe"`
	ToY       float64 `json:"toY" desc:"Ending Y coordinate of the swipe"`
}

ToolSwipeDirection implements the swipe_direction tool call.

func (*ToolSwipeDirection) ConvertActionToCallToolRequest

func (t *ToolSwipeDirection) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSwipeDirection) Description

func (t *ToolSwipeDirection) Description() string

func (*ToolSwipeDirection) Implement

func (t *ToolSwipeDirection) Implement() server.ToolHandlerFunc

func (*ToolSwipeDirection) Name

func (*ToolSwipeDirection) Options

func (t *ToolSwipeDirection) Options() []mcp.ToolOption

type ToolSwipeToTapApp

type ToolSwipeToTapApp struct {
	// Return data fields - these define the structure of data returned by this tool
	AppName string `json:"appName" desc:"Name of the app that was found and tapped"`
}

ToolSwipeToTapApp implements the swipe_to_tap_app tool call.

func (*ToolSwipeToTapApp) ConvertActionToCallToolRequest

func (t *ToolSwipeToTapApp) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSwipeToTapApp) Description

func (t *ToolSwipeToTapApp) Description() string

func (*ToolSwipeToTapApp) Implement

func (t *ToolSwipeToTapApp) Implement() server.ToolHandlerFunc

func (*ToolSwipeToTapApp) Name

func (*ToolSwipeToTapApp) Options

func (t *ToolSwipeToTapApp) Options() []mcp.ToolOption

type ToolSwipeToTapText

type ToolSwipeToTapText struct {
	// Return data fields - these define the structure of data returned by this tool
	Text string `json:"text" desc:"Text that was found and tapped"`
}

ToolSwipeToTapText implements the swipe_to_tap_text tool call.

func (*ToolSwipeToTapText) ConvertActionToCallToolRequest

func (t *ToolSwipeToTapText) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSwipeToTapText) Description

func (t *ToolSwipeToTapText) Description() string

func (*ToolSwipeToTapText) Implement

func (t *ToolSwipeToTapText) Implement() server.ToolHandlerFunc

func (*ToolSwipeToTapText) Name

func (*ToolSwipeToTapText) Options

func (t *ToolSwipeToTapText) Options() []mcp.ToolOption

type ToolSwipeToTapTexts

type ToolSwipeToTapTexts struct {
	// Return data fields - these define the structure of data returned by this tool
	Texts      []string `json:"texts" desc:"List of texts that were searched for"`
	TappedText string   `json:"tappedText" desc:"The specific text that was found and tapped"`
}

ToolSwipeToTapTexts implements the swipe_to_tap_texts tool call.

func (*ToolSwipeToTapTexts) ConvertActionToCallToolRequest

func (t *ToolSwipeToTapTexts) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolSwipeToTapTexts) Description

func (t *ToolSwipeToTapTexts) Description() string

func (*ToolSwipeToTapTexts) Implement

func (*ToolSwipeToTapTexts) Name

func (*ToolSwipeToTapTexts) Options

func (t *ToolSwipeToTapTexts) Options() []mcp.ToolOption

type ToolTapAbsXY

type ToolTapAbsXY struct {
	// Return data fields - these define the structure of data returned by this tool
	X float64 `json:"x" desc:"X coordinate where tap was performed (absolute pixels)"`
	Y float64 `json:"y" desc:"Y coordinate where tap was performed (absolute pixels)"`
}

ToolTapAbsXY implements the tap_abs_xy tool call.

func (*ToolTapAbsXY) ConvertActionToCallToolRequest

func (t *ToolTapAbsXY) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolTapAbsXY) Description

func (t *ToolTapAbsXY) Description() string

func (*ToolTapAbsXY) Implement

func (t *ToolTapAbsXY) Implement() server.ToolHandlerFunc

func (*ToolTapAbsXY) Name

func (t *ToolTapAbsXY) Name() option.ActionName

func (*ToolTapAbsXY) Options

func (t *ToolTapAbsXY) Options() []mcp.ToolOption

type ToolTapByCV

type ToolTapByCV struct {
}

ToolTapByCV implements the tap_cv tool call.

func (*ToolTapByCV) ConvertActionToCallToolRequest

func (t *ToolTapByCV) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolTapByCV) Description

func (t *ToolTapByCV) Description() string

func (*ToolTapByCV) Implement

func (t *ToolTapByCV) Implement() server.ToolHandlerFunc

func (*ToolTapByCV) Name

func (t *ToolTapByCV) Name() option.ActionName

func (*ToolTapByCV) Options

func (t *ToolTapByCV) Options() []mcp.ToolOption

type ToolTapByOCR

type ToolTapByOCR struct {
	// Return data fields - these define the structure of data returned by this tool
	Text string `json:"text" desc:"Text that was tapped by OCR"`
}

ToolTapByOCR implements the tap_ocr tool call.

func (*ToolTapByOCR) ConvertActionToCallToolRequest

func (t *ToolTapByOCR) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolTapByOCR) Description

func (t *ToolTapByOCR) Description() string

func (*ToolTapByOCR) Implement

func (t *ToolTapByOCR) Implement() server.ToolHandlerFunc

func (*ToolTapByOCR) Name

func (t *ToolTapByOCR) Name() option.ActionName

func (*ToolTapByOCR) Options

func (t *ToolTapByOCR) Options() []mcp.ToolOption

type ToolTapBySelector

type ToolTapBySelector struct {
	// Return data fields - these define the structure of data returned by this tool
	Selector string `json:"selector" desc:"CSS selector or XPath used for tap"`
}

ToolTapBySelector implements the tap_by_selector tool call.

func (*ToolTapBySelector) ConvertActionToCallToolRequest

func (t *ToolTapBySelector) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolTapBySelector) Description

func (t *ToolTapBySelector) Description() string

func (*ToolTapBySelector) Implement

func (t *ToolTapBySelector) Implement() server.ToolHandlerFunc

func (*ToolTapBySelector) Name

func (*ToolTapBySelector) Options

func (t *ToolTapBySelector) Options() []mcp.ToolOption

type ToolTapXY

type ToolTapXY struct {
	// Return data fields - these define the structure of data returned by this tool
	X float64 `json:"x" desc:"X coordinate where tap was performed"`
	Y float64 `json:"y" desc:"Y coordinate where tap was performed"`
}

ToolTapXY implements the tap_xy tool call.

func (*ToolTapXY) ConvertActionToCallToolRequest

func (t *ToolTapXY) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolTapXY) Description

func (t *ToolTapXY) Description() string

func (*ToolTapXY) Implement

func (t *ToolTapXY) Implement() server.ToolHandlerFunc

func (*ToolTapXY) Name

func (t *ToolTapXY) Name() option.ActionName

func (*ToolTapXY) Options

func (t *ToolTapXY) Options() []mcp.ToolOption

type ToolTerminateApp

type ToolTerminateApp struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name of the terminated app"`
	WasRunning  bool   `json:"wasRunning" desc:"Whether the app was actually running before termination"`
}

ToolTerminateApp implements the terminate_app tool call.

func (*ToolTerminateApp) ConvertActionToCallToolRequest

func (t *ToolTerminateApp) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolTerminateApp) Description

func (t *ToolTerminateApp) Description() string

func (*ToolTerminateApp) Implement

func (t *ToolTerminateApp) Implement() server.ToolHandlerFunc

func (*ToolTerminateApp) Name

func (*ToolTerminateApp) Options

func (t *ToolTerminateApp) Options() []mcp.ToolOption

type ToolWebCloseTab

type ToolWebCloseTab struct {
	// Return data fields - these define the structure of data returned by this tool
	TabIndex int `json:"tabIndex" desc:"Index of the closed tab"`
}

ToolWebCloseTab implements the web_close_tab tool call.

func (*ToolWebCloseTab) ConvertActionToCallToolRequest

func (t *ToolWebCloseTab) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolWebCloseTab) Description

func (t *ToolWebCloseTab) Description() string

func (*ToolWebCloseTab) Implement

func (t *ToolWebCloseTab) Implement() server.ToolHandlerFunc

func (*ToolWebCloseTab) Name

func (t *ToolWebCloseTab) Name() option.ActionName

func (*ToolWebCloseTab) Options

func (t *ToolWebCloseTab) Options() []mcp.ToolOption

type ToolWebLoginNoneUI

type ToolWebLoginNoneUI struct {
	// Return data fields - these define the structure of data returned by this tool
	PackageName string `json:"packageName" desc:"Package name used for web login"`
}

ToolWebLoginNoneUI implements the web_login_none_ui tool call.

func (*ToolWebLoginNoneUI) ConvertActionToCallToolRequest

func (t *ToolWebLoginNoneUI) ConvertActionToCallToolRequest(action option.MobileAction) (mcp.CallToolRequest, error)

func (*ToolWebLoginNoneUI) Description

func (t *ToolWebLoginNoneUI) Description() string

func (*ToolWebLoginNoneUI) Implement

func (t *ToolWebLoginNoneUI) Implement() server.ToolHandlerFunc

func (*ToolWebLoginNoneUI) Name

func (*ToolWebLoginNoneUI) Options

func (t *ToolWebLoginNoneUI) Options() []mcp.ToolOption

type UIA2Driver

type UIA2Driver struct {
	*ADBDriver
	// contains filtered or unexported fields
}

func NewUIA2Driver

func NewUIA2Driver(device *AndroidDevice) (*UIA2Driver, error)

func (*UIA2Driver) Back

func (ud *UIA2Driver) Back() (err error)

Back simulates a short press on the BACK button.

func (*UIA2Driver) BatteryInfo

func (ud *UIA2Driver) BatteryInfo() (batteryInfo types.BatteryInfo, err error)

func (*UIA2Driver) DeleteSession

func (ud *UIA2Driver) DeleteSession() (err error)

func (*UIA2Driver) DeviceInfo

func (ud *UIA2Driver) DeviceInfo() (deviceInfo types.DeviceInfo, err error)

func (*UIA2Driver) DoubleTap

func (ud *UIA2Driver) DoubleTap(x, y float64, opts ...option.ActionOption) error

func (*UIA2Driver) Drag

func (ud *UIA2Driver) Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

Drag performs a swipe from one coordinate to another coordinate. You can control the smoothness and speed of the swipe by specifying the number of steps. Each step execution is throttled to 5 milliseconds per step, so for a 100 steps, the swipe will take around 0.5 seconds to complete.

func (*UIA2Driver) InitSession

func (ud *UIA2Driver) InitSession(capabilities option.Capabilities) (err error)

func (*UIA2Driver) Input

func (ud *UIA2Driver) Input(text string, opts ...option.ActionOption) (err error)

SendKeys Android input does not support setting frequency.

func (*UIA2Driver) Orientation

func (ud *UIA2Driver) Orientation() (orientation types.Orientation, err error)

func (*UIA2Driver) PressKeyCodes

func (ud *UIA2Driver) PressKeyCodes(keyCode KeyCode, metaState KeyMeta, flags ...KeyFlag) (err error)

func (*UIA2Driver) Rotation

func (ud *UIA2Driver) Rotation() (rotation types.Rotation, err error)

func (*UIA2Driver) SIMClickAtPoint

func (ud *UIA2Driver) SIMClickAtPoint(x, y float64, opts ...option.ActionOption) error

ClickAtPoint 点击相对坐标 x, y: 点击坐标(相对坐标)

func (*UIA2Driver) SIMInput

func (ud *UIA2Driver) SIMInput(text string, opts ...option.ActionOption) error

SIMInput 仿真输入函数,模拟人类分批输入行为 将文本智能分割,英文单词和数字保持完整,中文按1-2个字符分割

func (*UIA2Driver) SIMSwipeFromPointToPoint

func (ud *UIA2Driver) SIMSwipeFromPointToPoint(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

SwipeFromPointToPoint 指定起始点和结束点进行滑动 fromX, fromY: 起始坐标(相对坐标) toX, toY: 结束坐标(相对坐标)

func (*UIA2Driver) SIMSwipeInArea

func (ud *UIA2Driver) SIMSwipeInArea(direction string, simAreaStartX, simAreaStartY, simAreaEndX, simAreaEndY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error

SwipeInArea 在指定区域内向指定方向滑动任意距离 direction: 滑动方向 ("up", "down", "left", "right") simAreaStartX, simAreaStartY, simAreaEndX, simAreaEndY: 区域范围(相对坐标) simMinDistance, simMaxDistance: 距离范围,如果相等则为固定距离,否则为随机距离

func (*UIA2Driver) SIMSwipeWithDirection

func (ud *UIA2Driver) SIMSwipeWithDirection(direction string, fromX, fromY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error

SwipeWithDirection 向指定方向滑动任意距离 direction: 滑动方向 ("up", "down", "left", "right") fromX, fromY: 起始坐标 simMinDistance, simMaxDistance: 距离范围,如果相等则为固定距离,否则为随机距离

func (*UIA2Driver) ScreenShot

func (ud *UIA2Driver) ScreenShot(opts ...option.ActionOption) (raw *bytes.Buffer, err error)

func (*UIA2Driver) SendActionKey

func (ud *UIA2Driver) SendActionKey(text string, opts ...option.ActionOption) (err error)

func (*UIA2Driver) SendUnicodeKeys

func (ud *UIA2Driver) SendUnicodeKeys(text string, opts ...option.ActionOption) (err error)

func (*UIA2Driver) SetPasteboard

func (ud *UIA2Driver) SetPasteboard(contentType types.PasteboardType, content string) (err error)

func (*UIA2Driver) Setup

func (ud *UIA2Driver) Setup() error

func (*UIA2Driver) Source

func (ud *UIA2Driver) Source(srcOpt ...option.SourceOption) (source string, err error)

func (*UIA2Driver) Status

func (ud *UIA2Driver) Status() (deviceStatus types.DeviceStatus, err error)

func (*UIA2Driver) Swipe

func (ud *UIA2Driver) Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

Swipe performs a swipe from one coordinate to another using the number of steps to determine smoothness and speed. Each step execution is throttled to 5ms per step. So for a 100 steps, the swipe will take about 1/2 second to complete.

`steps` is the number of move steps sent to the system

func (*UIA2Driver) TapAbsXY

func (ud *UIA2Driver) TapAbsXY(x, y float64, opts ...option.ActionOption) error

func (*UIA2Driver) TapXY

func (ud *UIA2Driver) TapXY(x, y float64, opts ...option.ActionOption) error

func (*UIA2Driver) TearDown

func (ud *UIA2Driver) TearDown() error

func (*UIA2Driver) TouchAndHold

func (ud *UIA2Driver) TouchAndHold(x, y float64, opts ...option.ActionOption) (err error)

func (*UIA2Driver) TouchByEvents

func (ud *UIA2Driver) TouchByEvents(events []types.TouchEvent, opts ...option.ActionOption) error

TouchByEvents performs a complex swipe using a sequence of touch events with pressure and size data

func (*UIA2Driver) WindowSize

func (ud *UIA2Driver) WindowSize() (size types.Size, err error)

type WDADriver

type WDADriver struct {
	Device  *IOSDevice
	Session *DriverSession
	// contains filtered or unexported fields
}

func NewWDADriver

func NewWDADriver(device *IOSDevice) (*WDADriver, error)

func (*WDADriver) AccessibleSource

func (wd *WDADriver) AccessibleSource() (source string, err error)

func (*WDADriver) ActiveAppInfo

func (wd *WDADriver) ActiveAppInfo() (info types.AppInfo, err error)

func (*WDADriver) ActiveAppsList

func (wd *WDADriver) ActiveAppsList() (appsList []types.AppBaseInfo, err error)

func (*WDADriver) AlertAccept

func (wd *WDADriver) AlertAccept(label ...string) (err error)

func (*WDADriver) AlertButtons

func (wd *WDADriver) AlertButtons() (btnLabels []string, err error)

func (*WDADriver) AlertDismiss

func (wd *WDADriver) AlertDismiss(label ...string) (err error)

func (*WDADriver) AlertSendKeys

func (wd *WDADriver) AlertSendKeys(text string) (err error)

func (*WDADriver) AlertText

func (wd *WDADriver) AlertText() (text string, err error)

func (*WDADriver) AppActivate

func (wd *WDADriver) AppActivate(bundleId string) (err error)

func (*WDADriver) AppClear

func (wd *WDADriver) AppClear(packageName string) error

func (*WDADriver) AppDeactivate

func (wd *WDADriver) AppDeactivate(second float64) (err error)

func (*WDADriver) AppLaunch

func (wd *WDADriver) AppLaunch(bundleId string) (err error)

func (*WDADriver) AppLaunchUnattached

func (wd *WDADriver) AppLaunchUnattached(bundleId string) (err error)

func (*WDADriver) AppState

func (wd *WDADriver) AppState(bundleId string) (runState types.AppState, err error)

func (*WDADriver) AppTerminate

func (wd *WDADriver) AppTerminate(bundleId string) (successful bool, err error)

func (*WDADriver) Back

func (wd *WDADriver) Back() (err error)

Back simulates a short press on the BACK button.

func (*WDADriver) Backspace

func (wd *WDADriver) Backspace(count int, opts ...option.ActionOption) (err error)

func (*WDADriver) BatteryInfo

func (wd *WDADriver) BatteryInfo() (batteryInfo types.BatteryInfo, err error)

func (*WDADriver) ClearFiles

func (wd *WDADriver) ClearFiles(paths ...string) error

func (*WDADriver) ClearImages

func (wd *WDADriver) ClearImages() error

func (*WDADriver) DeleteSession

func (wd *WDADriver) DeleteSession() (err error)

func (*WDADriver) DeviceInfo

func (wd *WDADriver) DeviceInfo() (deviceInfo types.DeviceInfo, err error)

func (*WDADriver) DoubleTap

func (wd *WDADriver) DoubleTap(x, y float64, opts ...option.ActionOption) error

func (*WDADriver) Drag

func (wd *WDADriver) Drag(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

func (*WDADriver) ForegroundInfo

func (wd *WDADriver) ForegroundInfo() (appInfo types.AppInfo, err error)

func (*WDADriver) GetAppiumSettings

func (wd *WDADriver) GetAppiumSettings() (settings map[string]interface{}, err error)

func (*WDADriver) GetDevice

func (wd *WDADriver) GetDevice() IDevice

func (*WDADriver) GetMjpegClient

func (wd *WDADriver) GetMjpegClient() *http.Client

func (*WDADriver) GetPasteboard

func (wd *WDADriver) GetPasteboard() (content string, err error)

func (*WDADriver) GetSession

func (wd *WDADriver) GetSession() *DriverSession

func (*WDADriver) HealthCheck

func (wd *WDADriver) HealthCheck() (err error)

func (*WDADriver) Home

func (wd *WDADriver) Home() (err error)

func (*WDADriver) HoverBySelector

func (wd *WDADriver) HoverBySelector(selector string, options ...option.ActionOption) (err error)

func (*WDADriver) InitSession

func (wd *WDADriver) InitSession(capabilities option.Capabilities) error

func (*WDADriver) Input

func (wd *WDADriver) Input(text string, opts ...option.ActionOption) (err error)

func (*WDADriver) IsHealthy

func (wd *WDADriver) IsHealthy() (healthy bool, err error)

func (*WDADriver) IsLocked

func (wd *WDADriver) IsLocked() (locked bool, err error)

func (*WDADriver) Location

func (wd *WDADriver) Location() (location types.Location, err error)

func (*WDADriver) Lock

func (wd *WDADriver) Lock() (err error)

func (*WDADriver) Orientation

func (wd *WDADriver) Orientation() (orientation types.Orientation, err error)

func (*WDADriver) PressButton

func (wd *WDADriver) PressButton(button types.DeviceButton) (err error)

func (*WDADriver) PullFiles

func (wd *WDADriver) PullFiles(localDir string, remoteDirs ...string) error

func (*WDADriver) PullImages

func (wd *WDADriver) PullImages(localDir string) error

func (*WDADriver) PushFile

func (wd *WDADriver) PushFile(localPath string, remoteDir string) error

func (*WDADriver) PushImage

func (wd *WDADriver) PushImage(localPath string) error

func (*WDADriver) Rotation

func (wd *WDADriver) Rotation() (rotation types.Rotation, err error)

func (*WDADriver) SIMClickAtPoint

func (wd *WDADriver) SIMClickAtPoint(x, y float64, opts ...option.ActionOption) error

SIMClickAtPoint 点击相对坐标 x, y: 点击坐标(相对坐标)

func (*WDADriver) SIMInput

func (wd *WDADriver) SIMInput(text string, opts ...option.ActionOption) error

SIMInput 仿真输入函数,模拟人类分批输入行为 将文本智能分割,英文单词和数字保持完整,中文按1-2个字符分割

func (*WDADriver) SIMSwipeFromPointToPoint

func (wd *WDADriver) SIMSwipeFromPointToPoint(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

SIMSwipeFromPointToPoint 指定起始点和结束点进行滑动 fromX, fromY: 起始坐标(相对坐标) toX, toY: 结束坐标(相对坐标)

func (*WDADriver) SIMSwipeInArea

func (wd *WDADriver) SIMSwipeInArea(direction string, simAreaStartX, simAreaStartY, simAreaEndX, simAreaEndY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error

SIMSwipeInArea 在指定区域内向指定方向滑动任意距离 direction: 滑动方向 ("up", "down", "left", "right") simAreaStartX, simAreaStartY, simAreaEndX, simAreaEndY: 区域范围(相对坐标) simMinDistance, simMaxDistance: 距离范围,如果相等则为固定距离,否则为随机距离

func (*WDADriver) SIMSwipeWithDirection

func (wd *WDADriver) SIMSwipeWithDirection(direction string, fromX, fromY, simMinDistance, simMaxDistance float64, opts ...option.ActionOption) error

SIMSwipeWithDirection 向指定方向滑动任意距离 direction: 滑动方向 ("up", "down", "left", "right") fromX, fromY: 起始坐标 simMinDistance, simMaxDistance: 距离范围,如果相等则为固定距离,否则为随机距离

func (*WDADriver) Scale

func (wd *WDADriver) Scale() (float64, error)

func (*WDADriver) Screen

func (wd *WDADriver) Screen() (screen Screen, err error)

func (*WDADriver) ScreenRecord

func (wd *WDADriver) ScreenRecord(opts ...option.ActionOption) (videoPath string, err error)

func (*WDADriver) ScreenShot

func (wd *WDADriver) ScreenShot(opts ...option.ActionOption) (raw *bytes.Buffer, err error)

func (*WDADriver) SecondaryClick

func (wd *WDADriver) SecondaryClick(x, y float64) (err error)

func (*WDADriver) SecondaryClickBySelector

func (wd *WDADriver) SecondaryClickBySelector(selector string, options ...option.ActionOption) (err error)

func (*WDADriver) SetAppiumSettings

func (wd *WDADriver) SetAppiumSettings(settings map[string]interface{}) (ret map[string]interface{}, err error)

func (*WDADriver) SetIme

func (wd *WDADriver) SetIme(ime string) error

func (*WDADriver) SetOrientation

func (wd *WDADriver) SetOrientation(orientation types.Orientation) (err error)

func (*WDADriver) SetPasteboard

func (wd *WDADriver) SetPasteboard(contentType types.PasteboardType, content string) (err error)

func (*WDADriver) SetRotation

func (wd *WDADriver) SetRotation(rotation types.Rotation) (err error)

func (*WDADriver) Setup

func (wd *WDADriver) Setup() error

func (*WDADriver) Source

func (wd *WDADriver) Source(srcOpt ...option.SourceOption) (source string, err error)

func (*WDADriver) StartCaptureLog

func (wd *WDADriver) StartCaptureLog(identifier ...string) error

func (*WDADriver) Status

func (wd *WDADriver) Status() (deviceStatus types.DeviceStatus, err error)

func (*WDADriver) StopCaptureLog

func (wd *WDADriver) StopCaptureLog() (result interface{}, err error)

func (*WDADriver) Swipe

func (wd *WDADriver) Swipe(fromX, fromY, toX, toY float64, opts ...option.ActionOption) error

func (*WDADriver) TapAbsXY

func (wd *WDADriver) TapAbsXY(x, y float64, opts ...option.ActionOption) error

func (*WDADriver) TapBySelector

func (wd *WDADriver) TapBySelector(text string, opts ...option.ActionOption) error

func (*WDADriver) TapXY

func (wd *WDADriver) TapXY(x, y float64, opts ...option.ActionOption) error

func (*WDADriver) TearDown

func (wd *WDADriver) TearDown() error

func (*WDADriver) TouchAndHold

func (wd *WDADriver) TouchAndHold(x, y float64, opts ...option.ActionOption) (err error)

FIXME: hold not work

func (*WDADriver) TouchByEvents

func (wd *WDADriver) TouchByEvents(events []types.TouchEvent, opts ...option.ActionOption) error

TouchByEvents performs a complex swipe using a sequence of touch events with pressure and size data

func (*WDADriver) Unlock

func (wd *WDADriver) Unlock() (err error)

func (*WDADriver) WdaShutdown

func (wd *WDADriver) WdaShutdown() (err error)

func (*WDADriver) WindowSize

func (wd *WDADriver) WindowSize() (size types.Size, err error)

type WebAgentResponse

type WebAgentResponse struct {
	Code    int         `json:"code"`
	Message string      `json:"msg"`
	Data    interface{} `json:"data"`
	Result  interface{} `json:"result"`
}

type XTDriver

type XTDriver struct {
	IDriver
	CVService  ai.ICVService  // OCR/CV
	LLMService ai.ILLMService // LLM
	// contains filtered or unexported fields
}

XTDriver = IDriver + AI

func GetOrCreateXTDriver

func GetOrCreateXTDriver(config DriverCacheConfig) (*XTDriver, error)

GetOrCreateXTDriver gets an existing driver from cache or creates a new one

func NewXTDriver

func NewXTDriver(driver IDriver, opts ...option.AIServiceOption) (*XTDriver, error)

func (*XTDriver) AIAction

func (dExt *XTDriver) AIAction(ctx context.Context, prompt string, opts ...option.ActionOption) (*AIExecutionResult, error)

AIAction performs AI-driven action and returns detailed execution result

func (*XTDriver) AIAssert

func (dExt *XTDriver) AIAssert(assertion string, opts ...option.ActionOption) (*AIExecutionResult, error)

AIAssert performs AI-driven assertion and returns detailed execution result

func (*XTDriver) AIQuery

func (dExt *XTDriver) AIQuery(text string, opts ...option.ActionOption) (*AIExecutionResult, error)

AIQuery performs AI-driven query and returns detailed execution result

func (*XTDriver) AutoPopupHandler

func (dExt *XTDriver) AutoPopupHandler() error

func (*XTDriver) CallMCPTool

func (dExt *XTDriver) CallMCPTool(ctx context.Context,
	serverName, toolName string, arguments map[string]any,
) (result *mcp.CallToolResult, err error)

CallMCPTool calls the specified MCP tool

func (*XTDriver) CheckPopup

func (dExt *XTDriver) CheckPopup() (popup *PopupInfo, err error)

func (*XTDriver) ClosePopupsHandler

func (dExt *XTDriver) ClosePopupsHandler() (err error)

func (*XTDriver) DoValidation

func (dExt *XTDriver) DoValidation(check, assert, expected string, message ...string) (aiResult *AIExecutionResult, err error)

func (*XTDriver) ExecuteAction

func (dExt *XTDriver) ExecuteAction(ctx context.Context, action option.MobileAction) (SessionData, error)

func (*XTDriver) FindScreenText

func (dExt *XTDriver) FindScreenText(text string, opts ...option.ActionOption) (textRect ai.OCRText, err error)

func (*XTDriver) FindUIResult

func (dExt *XTDriver) FindUIResult(opts ...option.ActionOption) (uiResult ai.UIResult, err error)

func (*XTDriver) GetMCPClient

func (dExt *XTDriver) GetMCPClient(serverName string) (client.MCPClient, bool)

GetMCPClient returns the MCP client for the specified server name

func (*XTDriver) GetScreenResult

func (dExt *XTDriver) GetScreenResult(opts ...option.ActionOption) (screenResult *ScreenResult, err error)

GetScreenResult takes a screenshot and returns the ScreenResult with metadata

func (*XTDriver) GetScreenTexts

func (dExt *XTDriver) GetScreenTexts(opts ...option.ActionOption) (ocrTexts ai.OCRTexts, err error)

GetScreenTexts takes a screenshot, returns the OCR recognition result

func (*XTDriver) LoopUntil

func (dExt *XTDriver) LoopUntil(findAction, findCondition, foundAction Action, opts ...option.ActionOption) error

func (*XTDriver) PlanNextAction

func (dExt *XTDriver) PlanNextAction(ctx context.Context, prompt string, opts ...option.ActionOption) (*PlanningExecutionResult, error)

PlanNextAction performs planning and returns unified planning information

func (*XTDriver) SecondaryClickByOCR

func (dExt *XTDriver) SecondaryClickByOCR(ocrText string, opts ...option.ActionOption) error

func (*XTDriver) SetMCPClients

func (dExt *XTDriver) SetMCPClients(clients map[string]client.MCPClient)

SetMCPClients sets the external MCP clients for the driver

func (*XTDriver) Setup

func (dExt *XTDriver) Setup() error

func (*XTDriver) StartToGoal

func (dExt *XTDriver) StartToGoal(ctx context.Context, prompt string, opts ...option.ActionOption) ([]*PlanningExecutionResult, error)

StartToGoal runs AI actions until task is finished or time limit is reached

func (*XTDriver) SwipeToTapApp

func (dExt *XTDriver) SwipeToTapApp(appName string, opts ...option.ActionOption) error

func (*XTDriver) SwipeToTapTexts

func (dExt *XTDriver) SwipeToTapTexts(texts []string, opts ...option.ActionOption) error

func (*XTDriver) TapByCV

func (dExt *XTDriver) TapByCV(opts ...option.ActionOption) error

func (*XTDriver) TapByOCR

func (dExt *XTDriver) TapByOCR(text string, opts ...option.ActionOption) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL