Documentation
¶
Index ¶
- Constants
- func Delete(url string, headers map[string]string) ([]byte, error)
- func Get(url string, headers map[string]string) ([]byte, error)
- func GetBoolFromValueInterface(data map[string]interface{}, key string) bool
- func GetDataFromRespBody(body []byte) (map[string]interface{}, error)
- func GetNumFromValueInterface(data map[string]interface{}, key string) int64
- func GetRotation() error
- func GetStringFromValueInterface(data map[string]interface{}, key string) string
- func JudgeResponseCorrect(body []byte, sessionId string) bool
- func Post(url string, data interface{}, headers map[string]string) ([]byte, error)
- func SetDebugLog()
- type AppBaseInfo
- type AppInfo
- type AppList
- type BatteryInfo
- type BundleIdRequest
- type ButtonName
- type Capabilities
- type DeviceInfo
- type DragOption
- type ElementLocation
- type ElementSearchRequest
- type HTTPClient
- type HoldRequest
- type Location
- type NotificationExpect
- type PauseTime
- type PhoneStatus
- type Scale
- type ScreenSize
- type ScreenSizeResponse
- type ScreenState
- type SessionRequest
- type SourceRequest
- type TextRequest
- type TypingRequest
- type UrlBody
- type WdaSession
- func (session *WdaSession) ActivateApp(bundleId string) error
- func (session *WdaSession) ActiveSiri(text string) error
- func (session *WdaSession) AlertAccept(client *HTTPClient) error
- func (session *WdaSession) AlertDismiss(client *HTTPClient) error
- func (session *WdaSession) AlertGet(client *HTTPClient) error
- func (session *WdaSession) BackToHomePage() error
- func (session *WdaSession) BaseURL() string
- func (session *WdaSession) CheckSession() (bool, error)
- func (session *WdaSession) ClearText(elementId string) error
- func (session *WdaSession) ClickElement(elementId string) error
- func (session *WdaSession) CloseSession() error
- func (session *WdaSession) CurrentScreenShot(picturePath, pictureName string) (string, error)
- func (session *WdaSession) DeactivateApp(time int) error
- func (session *WdaSession) DeleteSession() error
- func (session *WdaSession) DoubleTapWithLocation(x, y float64) error
- func (session *WdaSession) DragWithLocation(xBefore, yBefore, xLater, yLater float64) error
- func (session *WdaSession) EnsureSession() error
- func (session *WdaSession) ExpectedNotification(notificationName string, notificationType string, timeOut int64) error
- func (session *WdaSession) GetActiveAppInfo() (*AppInfo, error)
- func (session *WdaSession) GetAkaTree() error
- func (session *WdaSession) GetAppList() (*[]AppBaseInfo, error)
- func (session *WdaSession) GetAppState(bundleIdString string) (int64, error)
- func (session *WdaSession) GetBatteryInfo() (*BatteryInfo, error)
- func (session *WdaSession) GetDeviceInfo() (*DeviceInfo, error)
- func (session *WdaSession) GetLocation() (error, *Location)
- func (session *WdaSession) GetOrientation() (string, error)
- func (session *WdaSession) GetScreenSize() (*ScreenSizeResponse, error)
- func (session *WdaSession) GetScreenState() (*ScreenState, error)
- func (session *WdaSession) GetScreenshotBase64() (string, error)
- func (session *WdaSession) GetSession(bundleId string) error
- func (session *WdaSession) GetSourceTree() (string, error)
- func (session *WdaSession) GetStatus() (*PhoneStatus, error)
- func (session *WdaSession) GetWindowSize() (*WindowSize, error)
- func (session *WdaSession) IsLocked() (bool, error)
- func (session *WdaSession) LaunchApp(bundleId string) error
- func (session *WdaSession) LaunchAppWithoutSession(bundleId string) error
- func (session *WdaSession) LetSiriOpenUrl(RawUrl string) error
- func (session *WdaSession) LockedDevice() error
- func (session *WdaSession) PressButton(buttonType int) error
- func (session *WdaSession) ResetAppAuth(resource string) error
- func (session *WdaSession) SearchElement(searchType int, Parms string) (string, error)
- func (session *WdaSession) SessionID() string
- func (session *WdaSession) ShutDownWda() error
- func (session *WdaSession) TapWithLocation(location ElementLocation) error
- func (session *WdaSession) TerminateApp(bundleId string) error
- func (session *WdaSession) TouchAndHoldWithLocation(x, y, duration float64) error
- func (session *WdaSession) TypingText(elementId string, Text string) error
- func (session *WdaSession) UnlockedDevice() error
- type WindowSize
Constants ¶
const ( VolumeUp = 1 VolumeDown = 2 Home = 3 NotificationTypePlain = "plain" NotificationTypeDarwin = "darwin" StringNull = "" )
const ( UserAgent = "Go-HTTP-Client/1.0" ContentTypeJson = "application/json" PicturePath = "screenShot/" LinkText = 1 PartialLinkText = 2 ClassName = 3 Path = 4 ClassChain = 5 )
Variables ¶
This section is empty.
Functions ¶
func GetDataFromRespBody ¶
GetDataFromRespBody 用于处理wda标准返回数据中的value结构的数据,将其转为map
func JudgeResponseCorrect ¶
JudgeResponseCorrect 判断wda请求返回结果是否正确, 正确为true,错误为false
func SetDebugLog ¶
func SetDebugLog()
Types ¶
type AppBaseInfo ¶
type AppList ¶
type AppList struct {
Value []AppBaseInfo `json:"value"`
SessionId string `json:"sessionId"`
}
type BatteryInfo ¶
type BundleIdRequest ¶
type BundleIdRequest struct {
BundleId string `json:"bundleId"`
}
type ButtonName ¶
type ButtonName struct {
Name string `json:"name"`
}
type Capabilities ¶
type Capabilities struct {
BundleId string `json:"bundleId"`
}
type DeviceInfo ¶
type DeviceInfo struct {
TimeZone string `json:"timeZone"`
CurrentLocale string `json:"currentLocale"`
Model string `json:"model"`
Uuid string `json:"uuid"`
ThermalState string `json:"thermalState"`
UserInterfaceIdiom int64 `json:"userInterfaceIdiom"`
UserInterfaceStyle string `json:"userInterfaceStyle"`
Name string `json:"name"`
IsSimulator bool `json:"isSimulator"`
}
type DragOption ¶
type ElementLocation ¶
type ElementSearchRequest ¶
type HTTPClient ¶
type HTTPClient struct {
// contains filtered or unexported fields
}
HTTPClient HTTP
func NewHTTPClient ¶
func NewHTTPClient(timeout time.Duration) *HTTPClient
NewHTTPClient 创建新的HTTP客户端
func (*HTTPClient) DeleteRequest ¶
DeleteRequest 发送DELETE请求
func (*HTTPClient) GetRequest ¶
GetRequest 发送GET请求
func (*HTTPClient) PostRequest ¶
func (h *HTTPClient) PostRequest(url string, data interface{}, headers map[string]string) ([]byte, error)
PostRequest 发送POST请求
type HoldRequest ¶
type HoldRequest struct {
Duration float64 `json:"duration"`
// contains filtered or unexported fields
}
type NotificationExpect ¶
type PhoneStatus ¶
type ScreenSize ¶
type ScreenSize struct {
StatusBarSize WindowSize `json:"statusBarSize"`
Scale int64 `json:"scale"`
ScreenSize WindowSize `json:"screenSize"`
}
type ScreenSizeResponse ¶
type ScreenSizeResponse struct {
Value ScreenSize `json:"value"`
SessionId string `json:"sessionId"`
}
type ScreenState ¶
type ScreenState struct {
ScreenshotBase64 string `json:"screenshot_base64"`
SourceTreeXML string `json:"source_tree_xml"`
ActiveApp string `json:"active_app_bundle_id"`
Orientation string `json:"orientation"`
}
ScreenState 组合截图、UI树和设备元信息,供LLM视觉分析使用
type SessionRequest ¶
type SessionRequest struct {
Capabilities Capabilities `json:"capabilities"`
}
type SourceRequest ¶
type SourceRequest struct {
Resource string `json:"resource"`
}
type TextRequest ¶
type TextRequest struct {
Text string `json:"text"`
}
type TypingRequest ¶
type TypingRequest struct {
Value []byte `json:"value"`
}
type WdaSession ¶
type WdaSession struct {
// contains filtered or unexported fields
}
func GetWdaSession ¶
func GetWdaSession(url string) *WdaSession
func (*WdaSession) ActivateApp ¶
func (session *WdaSession) ActivateApp(bundleId string) error
ActivateApp 激活app?与启动有何区别暂时没搞清楚
func (*WdaSession) ActiveSiri ¶
func (session *WdaSession) ActiveSiri(text string) error
ActiveSiri 启动siri,输入指定文本
func (*WdaSession) AlertAccept ¶
func (session *WdaSession) AlertAccept(client *HTTPClient) error
func (*WdaSession) AlertDismiss ¶
func (session *WdaSession) AlertDismiss(client *HTTPClient) error
func (*WdaSession) AlertGet ¶
func (session *WdaSession) AlertGet(client *HTTPClient) error
func (*WdaSession) BackToHomePage ¶
func (session *WdaSession) BackToHomePage() error
BackToHomePage 返回home页
func (*WdaSession) CheckSession ¶
func (session *WdaSession) CheckSession() (bool, error)
func (*WdaSession) ClearText ¶
func (session *WdaSession) ClearText(elementId string) error
func (*WdaSession) ClickElement ¶
func (session *WdaSession) ClickElement(elementId string) error
func (*WdaSession) CloseSession ¶
func (session *WdaSession) CloseSession() error
CloseSession 关闭session
func (*WdaSession) CurrentScreenShot ¶
func (session *WdaSession) CurrentScreenShot(picturePath, pictureName string) (string, error)
CurrentScreenShot 当前页面截屏, 不置顶文件后缀,默认为.png
func (*WdaSession) DeactivateApp ¶
func (session *WdaSession) DeactivateApp(time int) error
DeactivateApp 让app处于后台状态指定时间
func (*WdaSession) DeleteSession ¶
func (session *WdaSession) DeleteSession() error
func (*WdaSession) DoubleTapWithLocation ¶
func (session *WdaSession) DoubleTapWithLocation(x, y float64) error
DoubleTapWithLocation 使用坐标双击
func (*WdaSession) DragWithLocation ¶
func (session *WdaSession) DragWithLocation(xBefore, yBefore, xLater, yLater float64) error
DragWithLocation 拖动操作 swipe操作与该操作本纸上为同一个
func (*WdaSession) EnsureSession ¶
func (session *WdaSession) EnsureSession() error
EnsureSession 确保存在有效的WDA session,如果没有则自动创建一个
func (*WdaSession) ExpectedNotification ¶
func (session *WdaSession) ExpectedNotification(notificationName string, notificationType string, timeOut int64) error
ExpectedNotification 判断是否出现一个预期中的notification
func (*WdaSession) GetActiveAppInfo ¶
func (session *WdaSession) GetActiveAppInfo() (*AppInfo, error)
func (*WdaSession) GetAppList ¶
func (session *WdaSession) GetAppList() (*[]AppBaseInfo, error)
func (*WdaSession) GetAppState ¶
func (session *WdaSession) GetAppState(bundleIdString string) (int64, error)
func (*WdaSession) GetBatteryInfo ¶
func (session *WdaSession) GetBatteryInfo() (*BatteryInfo, error)
GetBatteryInfo 获取电池信息
func (*WdaSession) GetDeviceInfo ¶
func (session *WdaSession) GetDeviceInfo() (*DeviceInfo, error)
GetDeviceInfo 获取设备当前的状态
func (*WdaSession) GetLocation ¶
func (session *WdaSession) GetLocation() (error, *Location)
GetLocation 用于获取iphone的经纬度,授权状态等数据
func (*WdaSession) GetOrientation ¶
func (session *WdaSession) GetOrientation() (string, error)
GetOrientation 获取当前屏幕方向
func (*WdaSession) GetScreenSize ¶
func (session *WdaSession) GetScreenSize() (*ScreenSizeResponse, error)
GetScreenSize 获取设备屏幕的点长和点宽,返回换算系数和ScreenSize
func (*WdaSession) GetScreenState ¶
func (session *WdaSession) GetScreenState() (*ScreenState, error)
GetScreenState 返回组合的屏幕状态:截图 + UI树 + 当前App + 屏幕方向
func (*WdaSession) GetScreenshotBase64 ¶
func (session *WdaSession) GetScreenshotBase64() (string, error)
GetScreenshotBase64 返回当前屏幕截图的base64编码字符串(不写入磁盘)
func (*WdaSession) GetSession ¶
func (session *WdaSession) GetSession(bundleId string) error
func (*WdaSession) GetSourceTree ¶
func (session *WdaSession) GetSourceTree() (string, error)
GetSourceTree 返回当前页面的无障碍树XML字符串(不写入磁盘)
func (*WdaSession) GetStatus ¶
func (session *WdaSession) GetStatus() (*PhoneStatus, error)
GetStatus 获取当前iphone上的wda状态
func (*WdaSession) GetWindowSize ¶
func (session *WdaSession) GetWindowSize() (*WindowSize, error)
GetWindowSize 获取当前窗口大小
func (*WdaSession) LaunchApp ¶
func (session *WdaSession) LaunchApp(bundleId string) error
func (*WdaSession) LaunchAppWithoutSession ¶
func (session *WdaSession) LaunchAppWithoutSession(bundleId string) error
LaunchAppWithoutSession 不需要指定session来启动app
func (*WdaSession) LetSiriOpenUrl ¶
func (session *WdaSession) LetSiriOpenUrl(RawUrl string) error
LetSiriOpenUrl 让siri打开一个指定的url 传入的url必须是绝对url,即带https或者http
func (*WdaSession) LockedDevice ¶
func (session *WdaSession) LockedDevice() error
func (*WdaSession) PressButton ¶
func (session *WdaSession) PressButton(buttonType int) error
PressButton 点击按钮,此处按钮指的是iphone的硬件按钮,硬件按钮名如下:
home,volumeUp,volumeDown
func (*WdaSession) ResetAppAuth ¶
func (session *WdaSession) ResetAppAuth(resource string) error
ResetAppAuth 重置app auth,暂时不清楚如何使用,先实现
func (*WdaSession) SearchElement ¶
func (session *WdaSession) SearchElement(searchType int, Parms string) (string, error)
SearchElement 以不同方式搜索元素
func (*WdaSession) SessionID ¶
func (session *WdaSession) SessionID() string
SessionID 返回当前session ID
func (*WdaSession) TapWithLocation ¶
func (session *WdaSession) TapWithLocation(location ElementLocation) error
TapWithLocation 使用坐标点击
func (*WdaSession) TerminateApp ¶
func (session *WdaSession) TerminateApp(bundleId string) error
TerminateApp 关闭app
func (*WdaSession) TouchAndHoldWithLocation ¶
func (session *WdaSession) TouchAndHoldWithLocation(x, y, duration float64) error
TouchAndHoldWithLocation 对指定坐标长按
func (*WdaSession) TypingText ¶
func (session *WdaSession) TypingText(elementId string, Text string) error
func (*WdaSession) UnlockedDevice ¶
func (session *WdaSession) UnlockedDevice() error
UnlockedDevice 解锁设备