gwda

package module
v0.0.0-...-c82d42d Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: MIT Imports: 25 Imported by: 0

README

Golang-wda

go doc go report license

使用 Golang 实现 appium/WebDriverAgent 的客户端库

参考 facebook-wda (python): https://github.com/openatx/facebook-wda

扩展库

安装

必须先安装好 WDA,安装步骤可参考 ATX 文档 - iOS 真机如何安装 WebDriverAgent 或者 WebDriverAgent 安装

go get -u github.com/electricbubble/gwda

使用

package main

import (
	"github.com/electricbubble/gwda"
	"log"
	"os"
	"path/filepath"
	"time"
)

func main() {
	// 通过 `iproxy` 或其他方式将 iOS 设备的 `WDA` 端口转发到本地端口
	// client, err := gwda.NewClient("http://localhost:8100")
	// 直接通过 USB 读取设备,默认与第一个设备进行连接
	client, err := gwda.NewUSBClient()
	// 也可以获取全部使用 USB 连接的设备,并指定某一个设备进行连接
	// deviceList, err := gwda.DeviceList()
	// client, err := gwda.NewUSBClient(deviceList[0])
	checkErr("连接设备", err)

	err = client.Lock()
	checkErr("触发锁屏", err)

	isLocked, err := client.IsLocked()
	checkErr("判断是否处于屏幕锁定状态", err)

	if isLocked {
		err = client.Unlock()
		checkErr("触发解锁", err)
	}

	err = client.Homescreen()
	checkErr("切换到主屏幕", err)

	time.Sleep(time.Second * 1)

	userHomeDir, _ := os.UserHomeDir()
	err = client.ScreenshotToDisk(filepath.Join(userHomeDir, "Desktop", "homescreen.png"))
	checkErr("截图并保存", err)

	deviceInfo, err := client.DeviceInfo()
	checkErr("获取设备信息", err)
	log.Println("Name:", deviceInfo.Name)
	log.Println("IsSimulator:", deviceInfo.IsSimulator)

	session, err := client.NewSession()
	checkErr("创建 session", err)

	// defer session.DeleteSession()

	windowSize, err := session.WindowSize()
	checkErr("获取当前应用的大小", err)
	// 实际获取的是当前 App 的大小,但当前 App 是 主屏幕 时,通常得到的就是当前设备的屏幕大小
	log.Println("UIKit Size (Points):", windowSize.Width, "x", windowSize.Height)

	scale, err := session.Scale()
	checkErr("获取 UIKit Scale factor", err)
	log.Println("UIKit Scale factor:", scale)
	log.Println("Native Resolution (Pixels):", float64(windowSize.Width)*scale, "x", float64(windowSize.Height)*scale)

	statusBarSize, err := session.StatusBarSize()
	checkErr("获取 status bar 的大小", err)
	log.Println("Status bar size:", statusBarSize.Width, "x", statusBarSize.Height)

	batteryInfo, err := session.BatteryInfo()
	checkErr("获取🔋电量信息", err)
	switch batteryInfo.State {
	case gwda.WDABatteryUnplugged:
		log.Println("State:", batteryInfo.State)
	case gwda.WDABatteryCharging:
		if batteryInfo.Level == 1 {
			log.Println("State:", gwda.WDABatteryFull)
		} else {
			log.Println("State:", batteryInfo.State)
		}
	case gwda.WDABatteryFull:
		log.Println("State:", batteryInfo.State)
	}
	log.Printf("Level: %.00f%%\n", batteryInfo.Level*100)

	bundleId := "com.apple.Preferences"

	appRunState, err := session.AppState(bundleId)
	checkErr("获取指定 App 的运行状态", err)
	switch appRunState {
	case gwda.WDAAppNotRunning:
		log.Println("该 App 未运行, 开始打开 App:", bundleId)
		err = session.AppLaunch(bundleId)
		checkErr("启动指定 App", err)
	case gwda.WDAAppRunningBack:
		log.Println("该 App 正后台运行中, 开始切换到前台运行:", bundleId)
		err = session.AppActivate(bundleId)
		checkErr("切换指定 App 到前台运行", err)
	case gwda.WDAAppRunningFront:
		log.Println("该 App 正前台运行中, 开始关闭 App:", bundleId)
		err = session.AppTerminate(bundleId)
		checkErr("关闭指定 App", err)

		log.Println("重新启动 App:", bundleId)
		err = session.AppLaunch(bundleId)
		checkErr("再启动指定 App", err)
	}

	log.Println("使当前 App 退回 主屏幕, 并至少等待 3s 后(默认等待时间)再切换到前台")
	err = session.AppDeactivate()
	checkErr("使当前 App 退回 主屏幕, 并至少等待 3s 后(默认等待时间)再切换到前台", err)

	activeAppInfo, err := session.ActiveAppInfo()
	checkErr("获取当前 App 的信息", err)
	log.Println("当前 App 的 PID:", activeAppInfo.Pid)

	err = session.SwipeUp()
	checkErr("向上👆滑动", err)

	err = session.Tap(20, 1)
	checkErr("点击指定坐标点", err)

	time.Sleep(time.Second * 1)

	elemSearch, err := session.FindElement(gwda.WDALocator{ClassName: gwda.WDAElementType{SearchField: true}})
	checkErr("找到 搜索输入框", err)

	err = elemSearch.Click()
	checkErr("点击 搜索输入框", err)

	err = session.SendKeys("音乐\n", 1)
	checkErr("通过 session 输入文本", err)

	err = elemSearch.Clear()
	checkErr("清空 搜索输入框", err)

	err = elemSearch.SendKeys("辅助功能-" + gwda.WDATextBackspaceSequence + "\n")
	checkErr("输入文本", err)

	imgSearch, format, err := elemSearch.ScreenshotToImage()
	checkErr("截图元素并保存为 image.Image", err)
	log.Println("搜索输入框 的截图图片格式:", format)
	log.Println("搜索输入框 的截图图片大小(像素):", imgSearch.Bounds().Size())

	elemSearchRet, err := session.FindElement(gwda.WDALocator{Predicate: "type in {'XCUIElementTypeTable', 'XCUIElementTypeCollectionView'} && visible == true"})
	checkErr("找到 搜索结果列表框", err)

	cellElemRets, err := elemSearchRet.FindVisibleCells()
	checkErr("找到全部 搜索结果", err)
	log.Printf("共找到 %d 个搜索结果\n", len(cellElemRets))

	elemCancel, err := session.FindElement(gwda.WDALocator{Predicate: "type == 'XCUIElementTypeButton' && name == '取消'"})
	checkErr("找到 取消 按钮", err)

	err = elemCancel.Click()
	checkErr("点击 取消 按钮", err)

	err = session.PressVolumeUpButton()
	checkErr("触发设备按键🔊音量⬆️", err)

	time.Sleep(time.Millisecond * 500)

	err = session.PressHomeButton()
	checkErr("触发设备按键 Home️", err)

	time.Sleep(time.Millisecond * 500)

	err = session.PressVolumeDownButton()
	checkErr("触发设备按键🔊音量⬇️", err)

	time.Sleep(time.Millisecond * 1500)
	err = session.SwipeLeft()
	checkErr("向左👈滑动", err)
	time.Sleep(time.Millisecond * 350)

	elemIcon, err := session.FindElement(gwda.WDALocator{ClassChain: "**/XCUIElementTypeIcon[`visible == true`]"})
	checkErr("找到 当前屏幕的第一个 App/文件夹", err)

	text, err := elemIcon.Text()
	checkErr("获取 当前屏幕第一个 App/文件夹 的文本内容", err)
	log.Println("当前屏幕第一个 App/文件夹 的文本内容:", text)

	rectIcon, err := elemIcon.Rect()
	checkErr("获取该 App/文件夹 的坐标和大小", err)
	log.Println("该 App/文件夹 的坐标和大小:", rectIcon)

	err = elemIcon.TouchAndHold(3)
	checkErr("按住并保持指定秒数 (默认1s)", err)

	time.Sleep(time.Millisecond * 150)
	err = session.PressHomeButton()
	checkErr("触发设备按键 Home️", err)
	time.Sleep(time.Millisecond * 150)

	err = session.ForceTouch(rectIcon.X+rectIcon.Width/2, rectIcon.Y+rectIcon.Height/2, 1, 0.5)
	checkErr("指定压力值, 触发 3D Touch, (默认保持 1s)", err)

	time.Sleep(time.Second * 3)
	err = session.PressHomeButton()
	checkErr("触发设备按键 Home️", err)
	time.Sleep(time.Millisecond * 150)

	orientation, err := session.Orientation()
	checkErr("获取当前设备方向", err)
	rotation, err := session.Rotation()
	checkErr("获取当前设备 Rotation", err)
	log.Println("Orientation:", orientation)
	log.Println("Rotation:", rotation)

	bundleId = "com.apple.calculator"
	err = session.AppLaunch(bundleId)
	checkErr("启动 App 计算器", err)

	switch orientation {
	case gwda.WDAOrientationPortrait:
		err = session.SetOrientation(gwda.WDAOrientationLandscapeLeft)
	default:
		err = session.SetRotation(gwda.WDARotation{X: 0, Y: 0, Z: 0})
	}
	checkErr("修改设备方向", err)

	err = session.SiriActivate("当前时间")
	checkErr("激活 Siri", err)
}

func checkErr(msg string, err error) {
	if err != nil {
		log.Fatalln(msg, err)
	}
}

以上代码仅使用了 iPhone X (13.4.1) 和 iPhone 6s (11.4.1) 进行了测试。

Thanks

Thank you JetBrains for providing free open source licenses

Documentation

Index

Constants

View Source
const (
	WDATextBackspaceSequence = "\u0008"
	WDATextDeleteSequence    = "\u007F"
)

Variables

View Source
var DefaultWaitInterval = time.Millisecond * 250
View Source
var DefaultWaitTimeout = time.Second * 60

Functions

func WDADebug

func WDADebug(b ...bool)

Types

type Client

type Client struct {
	MjpegURL *url.URL
	// contains filtered or unexported fields
}

func NewClient

func NewClient(deviceURL string, isInitializesAlertButtonSelector ...bool) (c *Client, err error)

NewClient

when `isInitializesAlertButtonSelector` is `true`

AcceptAlertButtonSelector: **/XCUIElementTypeButton[`label IN {'允许','好','仅在使用应用期间','暂不'}`]
DismissAlertButtonSelector: **/XCUIElementTypeButton[`label IN {'不允许','暂不'}`]

func NewUSBClient

func NewUSBClient(device ...Device) (c *Client, err error)

func (*Client) AccessibleSource

func (c *Client) AccessibleSource() (sJson string, err error)

AccessibleSource

Return application elements accessibility tree

ignore all elements except for the main window for accessibility tree

func (*Client) ActiveAppInfo

func (c *Client) ActiveAppInfo() (wdaActiveAppInfo WDAActiveAppInfo, err error)

ActiveAppInfo

get current active application

func (*Client) AlertAccept

func (c *Client) AlertAccept(label ...string) (err error)

func (*Client) AlertDismiss

func (c *Client) AlertDismiss(label ...string) (err error)

func (*Client) AlertText

func (c *Client) AlertText() (text string, err error)

func (*Client) AppLaunchUnattached

func (c *Client) AppLaunchUnattached(bundleId string) (err error)

AppLaunchUnattached

Launch the app with the specified bundle ID

shouldWaitForQuiescence: false

func (*Client) DeviceInfo

func (c *Client) DeviceInfo() (wdaDeviceInfo WDADeviceInfo, err error)

DeviceInfo

func (*Client) GetUSBMjpegHTTPClient

func (c *Client) GetUSBMjpegHTTPClient() (*http.Client, string, error)

func (*Client) HealthCheck

func (c *Client) HealthCheck() (err error)

HealthCheck

Checks health of XCTest by:

  1. Querying application for some elements,
  2. Triggering some device events.

!!! Health check might modify simulator state so it should only be called in-between testing sessions

func (*Client) Homescreen

func (c *Client) Homescreen() (err error)

Homescreen

Forces the device under test to switch to the home screen

func (*Client) IsLocked

func (c *Client) IsLocked() (bool, error)

IsLocked

Checks if the screen is locked or not.

func (*Client) IsWdaHealth

func (c *Client) IsWdaHealth() (isHealth bool, err error)

func (*Client) Lock

func (c *Client) Lock() (err error)

Lock

Forces the device under test to switch to the lock screen. An immediate return will happen if the device is already locked and an error is going to be thrown if the screen has not been locked after the timeout.

func (*Client) NewSession

func (c *Client) NewSession(capabilities ...WDASessionCapability) (s *Session, err error)

NewSession

Creates and saves new session for application

func (*Client) Screenshot

func (c *Client) Screenshot() (raw *bytes.Buffer, err error)

Screenshot

func (*Client) ScreenshotToDisk

func (c *Client) ScreenshotToDisk(filename string) (err error)

ScreenshotToDisk

func (*Client) ScreenshotToImage

func (c *Client) ScreenshotToImage() (img image.Image, format string, err error)

ScreenshotToImage

func (*Client) SetAcceptAlertButtonSelector

func (c *Client) SetAcceptAlertButtonSelector(classChainSelector string)

SetAcceptAlertButtonSelector

Sets custom class chain locators for accept/dismiss alert buttons location.

This might be useful if the default buttons detection algorithm fails to determine alert buttons properly when defaultAlertAction is set.

func (*Client) SetDismissAlertButtonSelector

func (c *Client) SetDismissAlertButtonSelector(classChainSelector string)

SetDismissAlertButtonSelector

func (*Client) Source

func (c *Client) Source(srcOpt ...WDASourceOption) (s string, err error)

Source

func (*Client) Status

func (c *Client) Status() (sJson string, err error)

Status

Checking service status

func (*Client) Unlock

func (c *Client) Unlock() (err error)

Unlock

Forces the device under test to unlock. An immediate return will happen if the device is already unlocked and an error is going to be thrown if the screen has not been unlocked after the timeout.

func (*Client) WdaShutdown

func (c *Client) WdaShutdown() (err error)

type Device

type Device struct {
	WDAPort                          int
	MjpegPort                        int
	IsInitializesAlertButtonSelector bool
	// contains filtered or unexported fields
}

func DeviceList

func DeviceList() (devices []Device, err error)

func (Device) DeviceID

func (d Device) DeviceID() int

func (Device) SerialNumber

func (d Device) SerialNumber() string

type Element

type Element struct {
	UID string
	// contains filtered or unexported fields
}

func (*Element) Clear

func (e *Element) Clear() (err error)

func (*Element) Click

func (e *Element) Click() (err error)

func (*Element) DoubleTap

func (e *Element) DoubleTap() error

DoubleTap

Sends a double tap event to a hittable point computed for the element.

func (*Element) Drag

func (e *Element) Drag(fromX, fromY, toX, toY int, pressForDuration ...int) (err error)

Drag

Clicks and holds for a specified duration (generally long enough to start a drag operation) then drags to the other coordinate.

func (*Element) DragFloat

func (e *Element) DragFloat(fromX, fromY, toX, toY float64, pressForDuration ...float64) (err error)

func (*Element) FindElement

func (e *Element) FindElement(wdaLocator WDALocator) (element *Element, err error)

FindElement

func (*Element) FindElements

func (e *Element) FindElements(wdaLocator WDALocator) (elements []*Element, err error)

FindElements

func (*Element) FindVisibleCells

func (e *Element) FindVisibleCells() (elements []*Element, err error)

FindVisibleCells

func (*Element) ForceTouch

func (e *Element) ForceTouch(pressure float64, duration ...float64) (err error)

ForceTouch

3D Touch

func (*Element) ForceTouchCoordinate

func (e *Element) ForceTouchCoordinate(wdaCoordinate WDACoordinate, pressure float64, duration ...float64) (err error)

func (*Element) GetAttribute

func (e *Element) GetAttribute(attr WDAElementAttribute) (value string, err error)

GetAttribute

Returns value of given property specified in WebDriver Spec Check the FBElement protocol to get list of supported attributes. This method also supports shortcuts, like wdName == name, wdValue == value.

func (*Element) IsAccessibilityContainer

func (e *Element) IsAccessibilityContainer() (isAccessibilityContainer bool, err error)

func (*Element) IsAccessible

func (e *Element) IsAccessible() (isAccessible bool, err error)

func (*Element) IsDisplayed

func (e *Element) IsDisplayed() (isDisplayed bool, err error)

func (*Element) IsEnabled

func (e *Element) IsEnabled() (isEnabled bool, err error)

func (*Element) IsSelected

func (e *Element) IsSelected() (isSelected bool, err error)

func (*Element) Label

func (e *Element) Label() (string, error)

func (*Element) Name

func (e *Element) Name() (string, error)

func (*Element) PickerWheelSelect

func (e *Element) PickerWheelSelect(order WDAPickerWheelSelectOrder, offset ...int) (err error)

func (*Element) PickerWheelSelectNext

func (e *Element) PickerWheelSelectNext(offset ...int) (err error)

func (*Element) PickerWheelSelectPrevious

func (e *Element) PickerWheelSelectPrevious(offset ...int) (err error)

func (*Element) Pinch

func (e *Element) Pinch(scale, velocity float64) (err error)

Pinch

Sends a pinching gesture with two touches.

The system makes a best effort to synthesize the requested scale and velocity: absolute accuracy is not guaranteed. Some values may not be possible based on the size of the element's frame - these will result in test failures.

@param scale The scale of the pinch gesture. Use a scale between 0 and 1 to "pinch close" or zoom out and a scale greater than 1 to "pinch open" or zoom in.

@param velocity The velocity of the pinch in scale factor per second.

func (*Element) PinchToZoomIn

func (e *Element) PinchToZoomIn() (err error)

PinchToZoomIn

scale, velocity = 2, 10

func (*Element) PinchToZoomOut

func (e *Element) PinchToZoomOut() (err error)

PinchToZoomOut

!! may not work

scale, velocity = 0.9, -4.5

func (*Element) PinchToZoomOutByActions

func (e *Element) PinchToZoomOutByActions(scale ...float64) (err error)

func (*Element) Rect

func (e *Element) Rect() (wdaRect WDARect, err error)

func (*Element) Rotate

func (e *Element) Rotate(rotation float64, velocity ...float64) (err error)

Rotate

Sends a rotation gesture with two touches.

The system makes a best effort to synthesize the requested rotation and velocity: absolute accuracy is not guaranteed. Some values may not be possible based on the size of the element's frame - these will result in test failures.

@param rotation The rotation of the gesture in radians.

@param velocity The velocity of the rotation gesture in radians per second.

func (*Element) Screenshot

func (e *Element) Screenshot() (raw *bytes.Buffer, err error)

Screenshot

func (*Element) ScreenshotToDisk

func (e *Element) ScreenshotToDisk(filename string) (err error)

ScreenshotToDisk

func (*Element) ScreenshotToImage

func (e *Element) ScreenshotToImage() (img image.Image, format string, err error)

ScreenshotToImage

func (*Element) ScrollDown

func (e *Element) ScrollDown(distance ...float64) (err error)

func (*Element) ScrollElementByName

func (e *Element) ScrollElementByName(name string) (err error)

ScrollElementByName

func (*Element) ScrollElementByPredicate

func (e *Element) ScrollElementByPredicate(predicate string) (err error)

func (*Element) ScrollLeft

func (e *Element) ScrollLeft(distance ...float64) (err error)

func (*Element) ScrollRight

func (e *Element) ScrollRight(distance ...float64) (err error)

func (*Element) ScrollToVisible

func (e *Element) ScrollToVisible() (err error)

func (*Element) ScrollUp

func (e *Element) ScrollUp(distance ...float64) (err error)

func (*Element) SendKeys

func (e *Element) SendKeys(text string, typingFrequency ...int) error

func (*Element) Swipe

func (e *Element) Swipe(fromX, fromY, toX, toY int) (err error)

Swipe

element.frame.origin.x + [request.arguments[@"fromX"] doubleValue]
element.frame.origin.y + [request.arguments[@"fromY"] doubleValue]
element.frame.origin.x + [request.arguments[@"toX"] doubleValue]
element.frame.origin.y + [request.arguments[@"toY"] doubleValue]

func (*Element) SwipeDirection

func (e *Element) SwipeDirection(direction WDASwipeDirection) (err error)

SwipeDirection

Sends a swipe gesture in the specified direction.

func (*Element) SwipeDown

func (e *Element) SwipeDown() (err error)

SwipeDown

Sends a swipe-down gesture.

func (*Element) SwipeFloat

func (e *Element) SwipeFloat(fromX, fromY, toX, toY float64) (err error)

func (*Element) SwipeLeft

func (e *Element) SwipeLeft() (err error)

SwipeLeft

Sends a swipe-left gesture.

func (*Element) SwipeRight

func (e *Element) SwipeRight() (err error)

SwipeRight

Sends a swipe-right gesture.

func (*Element) SwipeUp

func (e *Element) SwipeUp() (err error)

SwipeUp

Sends a swipe-up gesture.

func (*Element) Tap

func (e *Element) Tap(x, y int) error

func (*Element) TapFloat

func (e *Element) TapFloat(x, y float64) error

func (*Element) TapWithNumberOfTaps

func (e *Element) TapWithNumberOfTaps(numberOfTaps, numberOfTouches int) (err error)

TapWithNumberOfTaps

Sends one or more taps with one of more touch points.

func (*Element) Text

func (e *Element) Text() (text string, err error)

Text

FBFirstNonEmptyValue(element.wdValue, element.wdLabel);

func (*Element) TouchAndHold

func (e *Element) TouchAndHold(duration ...int) (err error)

TouchAndHold

Sends a long press gesture to a hittable point computed for the element, holding for the specified duration.

func (*Element) TouchAndHoldFloat

func (e *Element) TouchAndHoldFloat(duration ...float64) (err error)

func (*Element) TwoFingerTap

func (e *Element) TwoFingerTap() (err error)

TwoFingerTap

Sends a two finger tap event to a hittable point computed for the element.

func (*Element) Type

func (e *Element) Type() (elemType string, err error)

Type

Element's type ( WDAElementType )

func (*Element) Value

func (e *Element) Value() (string, error)

type Session

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

func (*Session) AccessibleSource

func (s *Session) AccessibleSource() (sJson string, err error)

AccessibleSource

Return application elements accessibility tree

ignore all elements except for the main window for accessibility tree

func (*Session) ActiveAppInfo

func (s *Session) ActiveAppInfo() (wdaActiveAppInfo WDAActiveAppInfo, err error)

ActiveAppInfo

get current active application

func (*Session) ActiveAppsList

func (s *Session) ActiveAppsList() (appsList []WDAAppBaseInfo, err error)

ActiveAppsList

use multitasking on iPad

func (*Session) ActiveElement

func (s *Session) ActiveElement() (element *Element, err error)

ActiveElement

returns the currently active element

[NSPredicate predicateWithFormat:@"hasKeyboardFocus == YES"]

func (*Session) AlertAccept

func (s *Session) AlertAccept(label ...string) (err error)

func (*Session) AlertButtons

func (s *Session) AlertButtons() (buttons []string, err error)

func (*Session) AlertDismiss

func (s *Session) AlertDismiss(label ...string) (err error)

func (*Session) AlertSendKeys

func (s *Session) AlertSendKeys(text string) (err error)

func (*Session) AlertText

func (s *Session) AlertText() (text string, err error)

func (*Session) AppActivate

func (s *Session) AppActivate(bundleId string) (err error)

AppActivate

Activate the application by restoring it from the background. Nothing will happen if the application is already in foreground. This method is only supported since Xcode9.

func (*Session) AppDeactivate

func (s *Session) AppDeactivate(seconds ...float64) (err error)

AppDeactivate

Deactivates application for given time and then activate it again

func (*Session) AppLaunch

func (s *Session) AppLaunch(bundleId string, opt ...WDAAppLaunchOption) (err error)

AppLaunch

Launch an application with given bundle identifier in scope of current session. !This method is only available since Xcode9 SDK

Default wait for quiescence

  1. registerApplicationWithBundleId
  2. launch OR activate

func (*Session) AppState

func (s *Session) AppState(bundleId string) (appRunState WDAAppRunState, err error)

AppState

Get the state of the particular application in scope of the current session. !This method is only returning reliable results since Xcode9 SDK

func (*Session) AppTerminate

func (s *Session) AppTerminate(bundleId string) (err error)

AppTerminate

Close the application by bundleId

  1. unregisterApplicationWithBundleId

func (*Session) BatteryInfo

func (s *Session) BatteryInfo() (wdaBatteryInfo WDABatteryInfo, err error)

BatteryInfo

level - Battery level in range [0.0, 1.0], where 1.0 means 100% charge.
state - Battery state. The following values are possible:
UIDeviceBatteryStateUnplugged = 1  // on battery, discharging
UIDeviceBatteryStateCharging = 2   // plugged in, less than 100%
UIDeviceBatteryStateFull = 3       // plugged in, at 100%

func (*Session) DeleteSession

func (s *Session) DeleteSession() (err error)

DeleteSession

kill session (and App) associated with that request

  1. alertsMonitor disable
  2. testedApplicationBundleId terminate

func (*Session) DeviceInfo

func (s *Session) DeviceInfo() (wdaDeviceInfo WDADeviceInfo, err error)

DeviceInfo

func (*Session) DoubleTap

func (s *Session) DoubleTap(x, y int) (err error)

DoubleTap

double tap coordinate

func (*Session) DoubleTapFloat

func (s *Session) DoubleTapFloat(x, y float64) (err error)

func (*Session) Drag

func (s *Session) Drag(fromX, fromY, toX, toY int, pressForDuration ...int) (err error)

Drag

Clicks and holds for a specified duration (generally long enough to start a drag operation) then drags to the other coordinate.

func (*Session) DragFloat

func (s *Session) DragFloat(fromX, fromY, toX, toY float64, pressForDuration ...float64) (err error)

func (*Session) FindElement

func (s *Session) FindElement(wdaLocator WDALocator) (element *Element, err error)

FindElement

func (*Session) FindElements

func (s *Session) FindElements(wdaLocator WDALocator) (elements []*Element, err error)

FindElements

func (*Session) ForceTouch

func (s *Session) ForceTouch(x, y int, pressure float64, duration ...float64) (err error)

func (*Session) ForceTouchCoordinate

func (s *Session) ForceTouchCoordinate(coordinate WDACoordinate, pressure float64, duration ...float64) (err error)

func (*Session) ForceTouchFloat

func (s *Session) ForceTouchFloat(x, y, pressure float64, duration ...float64) (err error)

func (*Session) GetActiveSession

func (s *Session) GetActiveSession() (wdaSessionInfo WDASessionInfo, err error)

GetActiveSession

get current session information

func (*Session) GetAppiumSettings

func (s *Session) GetAppiumSettings() (sJson string, err error)

func (*Session) GetPasteboard

func (s *Session) GetPasteboard(contentType WDAContentType) (raw *bytes.Buffer, err error)

GetPasteboard

It might work when `WebDriverAgentRunner` is in foreground on real devices. https://github.com/appium/WebDriverAgent/issues/330

func (*Session) GetPasteboardForImage

func (s *Session) GetPasteboardForImage() (img image.Image, format string, err error)

func (*Session) GetPasteboardForImageToDisk

func (s *Session) GetPasteboardForImageToDisk(filename string) (err error)

func (*Session) GetPasteboardForPlaintext

func (s *Session) GetPasteboardForPlaintext() (content string, err error)

func (*Session) GetPasteboardForUrl

func (s *Session) GetPasteboardForUrl() (content string, err error)

func (*Session) IsLocked

func (s *Session) IsLocked() (bool, error)

IsLocked

Checks if the screen is locked or not.

func (*Session) Lock

func (s *Session) Lock() (err error)

Lock

Forces the device under test to switch to the lock screen. An immediate return will happen if the device is already locked and an error is going to be thrown if the screen has not been locked after the timeout.

func (*Session) MatchTouchID

func (s *Session) MatchTouchID(isMatch bool) (bool, error)

MatchTouchID

Matches or mismatches TouchID request

func (*Session) Orientation

func (s *Session) Orientation() (orientation WDAOrientation, err error)

func (*Session) PerformActions

func (s *Session) PerformActions(actions *WDAActions) (err error)

PerformActions

fb_performW3CActions

func (*Session) PerformTouchActions

func (s *Session) PerformTouchActions(touchActions *WDATouchActions) (err error)

PerformTouchActions

fb_performAppiumTouchActions

func (*Session) PressButton

func (s *Session) PressButton(wdaDeviceButton WDADeviceButtonName) (err error)

PressButton

Presses the corresponding hardware button on the device !!! not a synchronous action

func (*Session) PressHomeButton

func (s *Session) PressHomeButton() (err error)

func (*Session) PressVolumeDownButton

func (s *Session) PressVolumeDownButton() (err error)

func (*Session) PressVolumeUpButton

func (s *Session) PressVolumeUpButton() (err error)

func (*Session) Rotation

func (s *Session) Rotation() (wdaRotation WDARotation, err error)

func (*Session) Scale

func (s *Session) Scale() (scale float64, err error)

Scale

func (*Session) Screen

func (s *Session) Screen() (wdaScreen WDAScreen, err error)

Screen

func (*Session) Screenshot

func (s *Session) Screenshot(element ...*Element) (raw *bytes.Buffer, err error)

Screenshot

OR takes a screenshot of the specified element

func (*Session) ScreenshotToDisk

func (s *Session) ScreenshotToDisk(filename string, element ...*Element) (err error)

ScreenshotToDisk

func (*Session) ScreenshotToImage

func (s *Session) ScreenshotToImage(element ...*Element) (img image.Image, format string, err error)

ScreenshotToImage

func (*Session) SendKeys

func (s *Session) SendKeys(text string, typingFrequency ...int) error

SendKeys

static NSUInteger FBMaxTypingFrequency = 60;

func (*Session) SetAppiumSetting

func (s *Session) SetAppiumSetting(key string, value interface{}) (sJson string, err error)

func (*Session) SetAppiumSettings

func (s *Session) SetAppiumSettings(settings map[string]interface{}) (sJson string, err error)

func (*Session) SetOrientation

func (s *Session) SetOrientation(orientation WDAOrientation) (err error)

func (*Session) SetPasteboard

func (s *Session) SetPasteboard(contentType WDAContentType, content string) (err error)

SetPasteboard Sets data to the general pasteboard

func (*Session) SetPasteboardForImageFromFile

func (s *Session) SetPasteboardForImageFromFile(filename string) (err error)

SetPasteboardForImageFromFile

func (*Session) SetPasteboardForPlaintext

func (s *Session) SetPasteboardForPlaintext(content string) (err error)

SetPasteboardForType

func (*Session) SetPasteboardForUrl

func (s *Session) SetPasteboardForUrl(url string) (err error)

SetPasteboardForUrl

func (*Session) SetRotation

func (s *Session) SetRotation(wdaRotation WDARotation) (err error)

func (*Session) SiriActivate

func (s *Session) SiriActivate(text string) (err error)

SiriActivate

Activates Siri service voice recognition with the given text to parse

func (*Session) SiriOpenURL

func (s *Session) SiriOpenURL(url string) (err error)

SiriOpenURL Open {%@} It doesn't actually work, right?

func (*Session) Source

func (s *Session) Source(srcOpt ...WDASourceOption) (sTree string, err error)

Source

func (*Session) StatusBarSize

func (s *Session) StatusBarSize() (wdaStatusBarSize WDASize, err error)

StatusBarSize

func (*Session) Swipe

func (s *Session) Swipe(fromX, fromY, toX, toY int) (err error)

func (*Session) SwipeCoordinate

func (s *Session) SwipeCoordinate(fromCoordinate, toCoordinate WDACoordinate) (err error)

func (*Session) SwipeDown

func (s *Session) SwipeDown() (err error)

SwipeDown

func (*Session) SwipeFloat

func (s *Session) SwipeFloat(fromX, fromY, toX, toY float64) (err error)

func (*Session) SwipeLeft

func (s *Session) SwipeLeft() (err error)

SwipeLeft

func (*Session) SwipeRight

func (s *Session) SwipeRight() (err error)

SwipeRight

func (*Session) SwipeUp

func (s *Session) SwipeUp() (err error)

SwipeUp

func (*Session) Tap

func (s *Session) Tap(x, y int) error

Tap

func (*Session) TapCoordinate

func (s *Session) TapCoordinate(wdaCoordinate WDACoordinate) error

TapCoordinate

func (*Session) TapFloat

func (s *Session) TapFloat(x, y float64) error

TapFloat

func (*Session) TouchAndHold

func (s *Session) TouchAndHold(x, y int, duration ...int) (err error)

TouchAndHold

touch and hold coordinate

func (*Session) TouchAndHoldFloat

func (s *Session) TouchAndHoldFloat(x, y float64, duration ...float64) (err error)

func (*Session) Unlock

func (s *Session) Unlock() (err error)

Unlock

Forces the device under test to unlock. An immediate return will happen if the device is already unlocked and an error is going to be thrown if the screen has not been unlocked after the timeout.

func (*Session) Wait

func (s *Session) Wait(condition WDACondition) error

Wait works like WaitWithTimeoutAndInterval, but using the default timeout and polling interval.

func (*Session) WaitWithTimeout

func (s *Session) WaitWithTimeout(condition WDACondition, timeout float64) error

WaitWithTimeout works like WaitWithTimeoutAndInterval, but with default polling interval.

func (*Session) WaitWithTimeoutAndInterval

func (s *Session) WaitWithTimeoutAndInterval(condition WDACondition, timeout, interval float64) (err error)

WaitWithTimeoutAndInterval waits for the condition to evaluate to true.

func (*Session) WindowSize

func (s *Session) WindowSize() (wdaSize WDASize, err error)

WindowSize

CGRect frame = request.session.activeApplication.wdFrame;

type WDAActionOptionFinger

type WDAActionOptionFinger []wdaBody

func NewWDAActionOptionFinger

func NewWDAActionOptionFinger(cap ...int) *WDAActionOptionFinger

func (*WDAActionOptionFinger) Down

func (*WDAActionOptionFinger) Move

func (*WDAActionOptionFinger) Pause

func (aof *WDAActionOptionFinger) Pause(duration ...float64) *WDAActionOptionFinger

func (*WDAActionOptionFinger) Up

type WDAActionOptionFingerMove

type WDAActionOptionFingerMove wdaBody

func NewWWDAActionOptionFingerMove

func NewWWDAActionOptionFingerMove() WDAActionOptionFingerMove

func (WDAActionOptionFingerMove) SetDuration

func (WDAActionOptionFingerMove) SetOrigin

func (WDAActionOptionFingerMove) SetXY

func (WDAActionOptionFingerMove) SetXYFloat

type WDAActions

type WDAActions []wdaBody

func NewWDAActions

func NewWDAActions(cap ...int) *WDAActions

func (*WDAActions) DoubleTap

func (act *WDAActions) DoubleTap(x, y int, element ...*Element) *WDAActions

func (*WDAActions) FingerActionOption

func (act *WDAActions) FingerActionOption(actOptFinger *WDAActionOptionFinger) *WDAActions

func (*WDAActions) Press

func (act *WDAActions) Press(x, y int, duration float64, element ...*Element) *WDAActions

func (*WDAActions) SendKeys

func (act *WDAActions) SendKeys(text string) *WDAActions

func (*WDAActions) Swipe

func (act *WDAActions) Swipe(fromX, fromY, toX, toY int, element ...*Element) *WDAActions

func (*WDAActions) SwipeCoordinate

func (act *WDAActions) SwipeCoordinate(fromCoordinate, toCoordinate WDACoordinate, element ...*Element) *WDAActions

func (*WDAActions) SwipeFloat

func (act *WDAActions) SwipeFloat(fromX, fromY, toX, toY float64, element ...*Element) *WDAActions

func (*WDAActions) Tap

func (act *WDAActions) Tap(x, y int, element ...*Element) *WDAActions

type WDAActiveAppInfo

type WDAActiveAppInfo struct {
	ProcessArguments struct {
		Env  interface{}   `json:"env"`
		Args []interface{} `json:"args"`
	} `json:"processArguments"`
	Name string `json:"name"`
	WDAAppBaseInfo
	// contains filtered or unexported fields
}

func (WDAActiveAppInfo) String

func (aai WDAActiveAppInfo) String() string

type WDAAppBaseInfo

type WDAAppBaseInfo struct {
	Pid      int    `json:"pid"`
	BundleID string `json:"bundleId"`
}

type WDAAppLaunchOption

type WDAAppLaunchOption wdaBody

launch application configuration

func NewWDAAppLaunchOption

func NewWDAAppLaunchOption() WDAAppLaunchOption

func (WDAAppLaunchOption) SetArguments

func (alo WDAAppLaunchOption) SetArguments(args []string) WDAAppLaunchOption

SetArguments

The optional array of application command line arguments. The arguments are going to be applied if the application was not running before.

func (WDAAppLaunchOption) SetEnvironment

func (alo WDAAppLaunchOption) SetEnvironment(env map[string]string) WDAAppLaunchOption

SetEnvironment

The optional dictionary of environment variables for the application, which is going to be executed. The environment variables are going to be applied if the application was not running before.

func (WDAAppLaunchOption) SetShouldWaitForQuiescence

func (alo WDAAppLaunchOption) SetShouldWaitForQuiescence(b bool) WDAAppLaunchOption

SetShouldWaitForQuiescence

It allows to turn on/off waiting for application quiescence, while performing queries.

type WDAAppRunState

type WDAAppRunState int
const (
	WDAAppNotRunning WDAAppRunState = 1 << iota
	WDAAppRunningBack
	WDAAppRunningFront
)

func (WDAAppRunState) String

func (v WDAAppRunState) String() string

type WDABatteryInfo

type WDABatteryInfo struct {
	Level float64         `json:"level"` // Battery level in range [0.0, 1.0], where 1.0 means 100% charge.
	State WDABatteryState `json:"state"` // Battery state ( 1: on battery, discharging; 2: plugged in, less than 100%, 3: plugged in, at 100% )
	// contains filtered or unexported fields
}

func (WDABatteryInfo) String

func (bi WDABatteryInfo) String() string

type WDABatteryState

type WDABatteryState int
const (
	WDABatteryUnplugged WDABatteryState = iota // on battery, discharging
	WDABatteryCharging                         // plugged in, less than 100%
	WDABatteryFull                             // plugged in, at 100%
)

func (WDABatteryState) String

func (v WDABatteryState) String() string

type WDACondition

type WDACondition func(s *Session) (bool, error)

type WDAContentType

type WDAContentType string
const (
	WDAContentTypePlaintext WDAContentType = "plaintext"
	WDAContentTypeImage     WDAContentType = "image"
	WDAContentTypeUrl       WDAContentType = "url"
)

type WDACoordinate

type WDACoordinate struct {
	X int `json:"x"`
	Y int `json:"y"`
}

type WDADeviceButtonName

type WDADeviceButtonName string
const (
	WDADeviceButtonHome       WDADeviceButtonName = "home"
	WDADeviceButtonVolumeUp   WDADeviceButtonName = "volumeUp"
	WDADeviceButtonVolumeDown WDADeviceButtonName = "volumeDown"
)

type WDADeviceInfo

type WDADeviceInfo struct {
	TimeZone           string `json:"timeZone"`
	CurrentLocale      string `json:"currentLocale"`
	Model              string `json:"model"`
	UUID               string `json:"uuid"`
	UserInterfaceIdiom int    `json:"userInterfaceIdiom"`
	UserInterfaceStyle string `json:"userInterfaceStyle"`
	Name               string `json:"name"`
	IsSimulator        bool   `json:"isSimulator"`
	// contains filtered or unexported fields
}

func (WDADeviceInfo) String

func (di WDADeviceInfo) String() string

type WDAElementAttribute

type WDAElementAttribute wdaBody

func NewWDAElementAttribute

func NewWDAElementAttribute() WDAElementAttribute

func (WDAElementAttribute) SetAccessibilityContainer

func (ea WDAElementAttribute) SetAccessibilityContainer(b bool) WDAElementAttribute

SetAccessibilityContainer

Whether element is an accessibility container (contains children of any depth that are accessible)

func (WDAElementAttribute) SetAccessible

func (ea WDAElementAttribute) SetAccessible(b bool) WDAElementAttribute

SetAccessible

Whether element is accessible

func (WDAElementAttribute) SetEnabled

func (ea WDAElementAttribute) SetEnabled(b bool) WDAElementAttribute

SetEnabled

Whether element is enabled

func (WDAElementAttribute) SetLabel

SetLabel

Element's label

func (WDAElementAttribute) SetName

SetName

Element's name

func (WDAElementAttribute) SetSelected

func (ea WDAElementAttribute) SetSelected(b bool) WDAElementAttribute

SetSelected

Element's selected state

func (WDAElementAttribute) SetType

SetType

Element's type

func (WDAElementAttribute) SetUID

SetUID

Element's unique identifier

func (WDAElementAttribute) SetValue

SetValue

Element's value

func (WDAElementAttribute) SetVisible

func (ea WDAElementAttribute) SetVisible(b bool) WDAElementAttribute

SetVisible

Whether element is visible

func (WDAElementAttribute) String

func (ea WDAElementAttribute) String() string

type WDAElementType

type WDAElementType struct {
	Any                bool `json:"XCUIElementTypeAny"`
	Other              bool `json:"XCUIElementTypeOther"`
	Application        bool `json:"XCUIElementTypeApplication"`
	Group              bool `json:"XCUIElementTypeGroup"`
	Window             bool `json:"XCUIElementTypeWindow"`
	Sheet              bool `json:"XCUIElementTypeSheet"`
	Drawer             bool `json:"XCUIElementTypeDrawer"`
	Alert              bool `json:"XCUIElementTypeAlert"`
	Dialog             bool `json:"XCUIElementTypeDialog"`
	Button             bool `json:"XCUIElementTypeButton"`
	RadioButton        bool `json:"XCUIElementTypeRadioButton"`
	RadioGroup         bool `json:"XCUIElementTypeRadioGroup"`
	CheckBox           bool `json:"XCUIElementTypeCheckBox"`
	DisclosureTriangle bool `json:"XCUIElementTypeDisclosureTriangle"`
	PopUpButton        bool `json:"XCUIElementTypePopUpButton"`
	ComboBox           bool `json:"XCUIElementTypeComboBox"`
	MenuButton         bool `json:"XCUIElementTypeMenuButton"`
	ToolbarButton      bool `json:"XCUIElementTypeToolbarButton"`
	Popover            bool `json:"XCUIElementTypePopover"`
	Keyboard           bool `json:"XCUIElementTypeKeyboard"`
	Key                bool `json:"XCUIElementTypeKey"`
	NavigationBar      bool `json:"XCUIElementTypeNavigationBar"`
	TabBar             bool `json:"XCUIElementTypeTabBar"`
	TabGroup           bool `json:"XCUIElementTypeTabGroup"`
	Toolbar            bool `json:"XCUIElementTypeToolbar"`
	StatusBar          bool `json:"XCUIElementTypeStatusBar"`
	Table              bool `json:"XCUIElementTypeTable"`
	TableRow           bool `json:"XCUIElementTypeTableRow"`
	TableColumn        bool `json:"XCUIElementTypeTableColumn"`
	Outline            bool `json:"XCUIElementTypeOutline"`
	OutlineRow         bool `json:"XCUIElementTypeOutlineRow"`
	Browser            bool `json:"XCUIElementTypeBrowser"`
	CollectionView     bool `json:"XCUIElementTypeCollectionView"`
	Slider             bool `json:"XCUIElementTypeSlider"`
	PageIndicator      bool `json:"XCUIElementTypePageIndicator"`
	ProgressIndicator  bool `json:"XCUIElementTypeProgressIndicator"`
	ActivityIndicator  bool `json:"XCUIElementTypeActivityIndicator"`
	SegmentedControl   bool `json:"XCUIElementTypeSegmentedControl"`
	Picker             bool `json:"XCUIElementTypePicker"`
	PickerWheel        bool `json:"XCUIElementTypePickerWheel"`
	Switch             bool `json:"XCUIElementTypeSwitch"`
	Toggle             bool `json:"XCUIElementTypeToggle"`
	Link               bool `json:"XCUIElementTypeLink"`
	Image              bool `json:"XCUIElementTypeImage"`
	Icon               bool `json:"XCUIElementTypeIcon"`
	SearchField        bool `json:"XCUIElementTypeSearchField"`
	ScrollView         bool `json:"XCUIElementTypeScrollView"`
	ScrollBar          bool `json:"XCUIElementTypeScrollBar"`
	StaticText         bool `json:"XCUIElementTypeStaticText"`
	TextField          bool `json:"XCUIElementTypeTextField"`
	SecureTextField    bool `json:"XCUIElementTypeSecureTextField"`
	DatePicker         bool `json:"XCUIElementTypeDatePicker"`
	TextView           bool `json:"XCUIElementTypeTextView"`
	Menu               bool `json:"XCUIElementTypeMenu"`
	MenuItem           bool `json:"XCUIElementTypeMenuItem"`
	MenuBar            bool `json:"XCUIElementTypeMenuBar"`
	MenuBarItem        bool `json:"XCUIElementTypeMenuBarItem"`
	Map                bool `json:"XCUIElementTypeMap"`
	WebView            bool `json:"XCUIElementTypeWebView"`
	IncrementArrow     bool `json:"XCUIElementTypeIncrementArrow"`
	DecrementArrow     bool `json:"XCUIElementTypeDecrementArrow"`
	Timeline           bool `json:"XCUIElementTypeTimeline"`
	RatingIndicator    bool `json:"XCUIElementTypeRatingIndicator"`
	ValueIndicator     bool `json:"XCUIElementTypeValueIndicator"`
	SplitGroup         bool `json:"XCUIElementTypeSplitGroup"`
	Splitter           bool `json:"XCUIElementTypeSplitter"`
	RelevanceIndicator bool `json:"XCUIElementTypeRelevanceIndicator"`
	ColorWell          bool `json:"XCUIElementTypeColorWell"`
	HelpTag            bool `json:"XCUIElementTypeHelpTag"`
	Matte              bool `json:"XCUIElementTypeMatte"`
	DockItem           bool `json:"XCUIElementTypeDockItem"`
	Ruler              bool `json:"XCUIElementTypeRuler"`
	RulerMarker        bool `json:"XCUIElementTypeRulerMarker"`
	Grid               bool `json:"XCUIElementTypeGrid"`
	LevelIndicator     bool `json:"XCUIElementTypeLevelIndicator"`
	Cell               bool `json:"XCUIElementTypeCell"`
	LayoutArea         bool `json:"XCUIElementTypeLayoutArea"`
	LayoutItem         bool `json:"XCUIElementTypeLayoutItem"`
	Handle             bool `json:"XCUIElementTypeHandle"`
	Stepper            bool `json:"XCUIElementTypeStepper"`
	Tab                bool `json:"XCUIElementTypeTab"`
	TouchBar           bool `json:"XCUIElementTypeTouchBar"`
	StatusItem         bool `json:"XCUIElementTypeStatusItem"`
}

WDAElementType !!! This mapping should be updated if there are changes after each new XCTest release"`

func (WDAElementType) String

func (et WDAElementType) String() string

type WDALocator

type WDALocator struct {
	ClassName WDAElementType `json:"class name"`

	// isSearchByIdentifier
	Name            string `json:"name"`
	Id              string `json:"id"`
	AccessibilityId string `json:"accessibility id"`

	// partialSearch
	LinkText        WDAElementAttribute `json:"link text"`
	PartialLinkText WDAElementAttribute `json:"partial link text"`

	Predicate string `json:"predicate string"`

	ClassChain string `json:"class chain"`

	XPath string `json:"xpath"`
}

type WDAOrientation

type WDAOrientation string
const (
	WDAOrientationPortrait           WDAOrientation = "PORTRAIT"                                   // Device oriented vertically, home button on the bottom
	WDAOrientationPortraitUpsideDown WDAOrientation = "UIA_DEVICE_ORIENTATION_PORTRAIT_UPSIDEDOWN" // Device oriented vertically, home button on the top
	WDAOrientationLandscapeLeft      WDAOrientation = "LANDSCAPE"                                  // Device oriented horizontally, home button on the right
	WDAOrientationLandscapeRight     WDAOrientation = "UIA_DEVICE_ORIENTATION_LANDSCAPERIGHT"      // Device oriented horizontally, home button on the left
)

func (WDAOrientation) String

func (v WDAOrientation) String() string

type WDAPickerWheelSelectOrder

type WDAPickerWheelSelectOrder string
const (
	WDAPickerWheelSelectOrderNext     WDAPickerWheelSelectOrder = "next"
	WDAPickerWheelSelectOrderPrevious WDAPickerWheelSelectOrder = "previous"
)

type WDARect

type WDARect struct {
	WDACoordinate
	WDASize
}

type WDARotation

type WDARotation struct {
	X int `json:"x"`
	Y int `json:"y"`
	Z int `json:"z"`
	// contains filtered or unexported fields
}

func (WDARotation) String

func (r WDARotation) String() string

type WDAScreen

type WDAScreen struct {
	StatusBarSize WDASize `json:"statusBarSize"`
	Scale         float64 `json:"scale"`
	// contains filtered or unexported fields
}

func (WDAScreen) String

func (s WDAScreen) String() string

type WDASessionCapability

type WDASessionCapability wdaBody

func NewWDASessionCapability

func NewWDASessionCapability(bundleId ...string) WDASessionCapability

NewWDASessionCapability

Default wait for quiescence

func (WDASessionCapability) SetAppLaunchOption

SetAppLaunchOption

func (WDASessionCapability) SetDefaultAlertAction

func (sc WDASessionCapability) SetDefaultAlertAction(sAlertAction WDASessionDefaultAlertAction) WDASessionCapability

SetDefaultAlertAction

Creates and saves new session for application with default alert handling behaviour

Default is disabled

func (WDASessionCapability) SetElementResponseAttributes

func (sc WDASessionCapability) SetElementResponseAttributes(s string) WDASessionCapability

SetElementResponseAttributes

Default is `"type,label"` static NSString *FBElementResponseAttributes = @"type,label";

func (WDASessionCapability) SetEventloopIdleDelaySec

func (sc WDASessionCapability) SetEventloopIdleDelaySec(seconds int) WDASessionCapability

SetEventloopIdleDelaySec

Once the methods were swizzled they stay like that since the only change in the implementation is the thread sleep, which is skipped on setting it to zero.

<= 0 disableEventLoopDelay

Default is `0` static NSTimeInterval eventloopIdleDelay = 0;

func (WDASessionCapability) SetMaxTypingFrequency

func (sc WDASessionCapability) SetMaxTypingFrequency(n int) WDASessionCapability

SetMaxTypingFrequency

Default is `60` static NSUInteger FBMaxTypingFrequency = 60;

func (WDASessionCapability) SetShouldUseCompactResponses

func (sc WDASessionCapability) SetShouldUseCompactResponses(b bool) WDASessionCapability

SetShouldUseCompactResponses

Default is `true` static BOOL FBShouldUseCompactResponses = YES;

func (WDASessionCapability) SetShouldUseSingletonTestManager

func (sc WDASessionCapability) SetShouldUseSingletonTestManager(b bool) WDASessionCapability

SetShouldUseSingletonTestManager

Default is `true` static BOOL FBShouldUseSingletonTestManager = YES;

func (WDASessionCapability) SetShouldUseTestManagerForVisibilityDetection

func (sc WDASessionCapability) SetShouldUseTestManagerForVisibilityDetection(b bool) WDASessionCapability

SetShouldUseTestManagerForVisibilityDetection

Default is `false` static BOOL FBShouldUseTestManagerForVisibilityDetection = NO;

type WDASessionDefaultAlertAction

type WDASessionDefaultAlertAction string
const (
	WDASessionAlertActionAccept  WDASessionDefaultAlertAction = "accept"
	WDASessionAlertActionDismiss WDASessionDefaultAlertAction = "dismiss"
)

type WDASessionInfo

type WDASessionInfo struct {
	Capabilities struct {
		CFBundleIdentifier string `json:"CFBundleIdentifier"`
		BrowserName        string `json:"browserName"`
		Device             string `json:"device"`
		SdkVersion         string `json:"sdkVersion"`
	} `json:"capabilities"`
	SessionID string `json:"sessionId"`
	// contains filtered or unexported fields
}

func (WDASessionInfo) String

func (si WDASessionInfo) String() string

type WDASize

type WDASize struct {
	Width  int `json:"width"`
	Height int `json:"height"`
	// contains filtered or unexported fields
}

func (WDASize) String

func (s WDASize) String() string

type WDASourceOption

type WDASourceOption wdaBody

func NewWDASourceOption

func NewWDASourceOption() WDASourceOption

NewWDASourceOption

Default: "format": "xml"

func (WDASourceOption) SetExcludedAttributes

func (so WDASourceOption) SetExcludedAttributes(excludedAttributes []string) WDASourceOption

SetExcludedAttributes

only `xml` supported.

func (WDASourceOption) SetFormatAsDescription

func (so WDASourceOption) SetFormatAsDescription() WDASourceOption

func (WDASourceOption) SetFormatAsJson

func (so WDASourceOption) SetFormatAsJson() WDASourceOption

func (WDASourceOption) SetFormatAsXml

func (so WDASourceOption) SetFormatAsXml() WDASourceOption

type WDASwipeDirection

type WDASwipeDirection string
const (
	WDASwipeDirectionUp    WDASwipeDirection = "up"
	WDASwipeDirectionDown  WDASwipeDirection = "down"
	WDASwipeDirectionLeft  WDASwipeDirection = "left"
	WDASwipeDirectionRight WDASwipeDirection = "right"
)

type WDATouchActionOptionLongPress

type WDATouchActionOptionLongPress wdaBody

func NewWDATouchActionOptionLongPress

func NewWDATouchActionOptionLongPress() WDATouchActionOptionLongPress

func (WDATouchActionOptionLongPress) SetElement

func (WDATouchActionOptionLongPress) SetXY

func (WDATouchActionOptionLongPress) SetXYCoordinate

func (WDATouchActionOptionLongPress) SetXYFloat

type WDATouchActionOptionMoveTo

type WDATouchActionOptionMoveTo wdaBody

func NewWDATouchActionOptionMoveTo

func NewWDATouchActionOptionMoveTo() WDATouchActionOptionMoveTo

func (WDATouchActionOptionMoveTo) SetElement

func (WDATouchActionOptionMoveTo) SetXY

func (WDATouchActionOptionMoveTo) SetXYCoordinate

func (WDATouchActionOptionMoveTo) SetXYFloat

type WDATouchActionOptionPress

type WDATouchActionOptionPress wdaBody

func NewWDATouchActionOptionPress

func NewWDATouchActionOptionPress() WDATouchActionOptionPress

func (WDATouchActionOptionPress) SetElement

func (WDATouchActionOptionPress) SetPressure

func (WDATouchActionOptionPress) SetXY

func (WDATouchActionOptionPress) SetXYCoordinate

func (tao WDATouchActionOptionPress) SetXYCoordinate(coordinate WDACoordinate) WDATouchActionOptionPress

func (WDATouchActionOptionPress) SetXYFloat

type WDATouchActionOptionTap

type WDATouchActionOptionTap wdaBody

func NewWDATouchActionOptionTap

func NewWDATouchActionOptionTap() WDATouchActionOptionTap

func (WDATouchActionOptionTap) SetCount

func (WDATouchActionOptionTap) SetElement

func (tao WDATouchActionOptionTap) SetElement(element *Element) WDATouchActionOptionTap

func (WDATouchActionOptionTap) SetXY

func (WDATouchActionOptionTap) SetXYFloat

type WDATouchActions

type WDATouchActions []wdaBody

func NewWDATouchActions

func NewWDATouchActions(cap ...int) *WDATouchActions

func (*WDATouchActions) Cancel

func (ta *WDATouchActions) Cancel() *WDATouchActions

func (*WDATouchActions) LongPress

func (ta *WDATouchActions) LongPress(optLongPress WDATouchActionOptionLongPress) *WDATouchActions

func (*WDATouchActions) MoveTo

func (*WDATouchActions) Press

func (*WDATouchActions) Release

func (ta *WDATouchActions) Release() *WDATouchActions

func (*WDATouchActions) Tap

func (*WDATouchActions) Wait

func (ta *WDATouchActions) Wait(duration ...float64) *WDATouchActions

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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