mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-26 02:40:05 +08:00
change: remove unused UI APIs
This commit is contained in:
@@ -4,8 +4,6 @@ import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"math"
|
||||
"reflect"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -30,13 +28,6 @@ func NewCapabilities() Capabilities {
|
||||
return make(Capabilities)
|
||||
}
|
||||
|
||||
func (caps Capabilities) WithAppLaunchOption(launchOpt AppLaunchOption) Capabilities {
|
||||
for k, v := range launchOpt {
|
||||
caps[k] = v
|
||||
}
|
||||
return caps
|
||||
}
|
||||
|
||||
// WithDefaultAlertAction
|
||||
func (caps Capabilities) WithDefaultAlertAction(alertAction AlertAction) Capabilities {
|
||||
caps["defaultAlertAction"] = alertAction
|
||||
@@ -286,44 +277,6 @@ func (v AppState) String() string {
|
||||
}
|
||||
}
|
||||
|
||||
// AppLaunchOption Configure app launch parameters
|
||||
type AppLaunchOption map[string]interface{}
|
||||
|
||||
func NewAppLaunchOption() AppLaunchOption {
|
||||
return make(AppLaunchOption)
|
||||
}
|
||||
|
||||
func (opt AppLaunchOption) WithBundleId(bundleId string) AppLaunchOption {
|
||||
opt["bundleId"] = bundleId
|
||||
return opt
|
||||
}
|
||||
|
||||
// WithShouldWaitForQuiescence whether to wait for quiescence on application startup
|
||||
// Defaults to `true`
|
||||
func (opt AppLaunchOption) WithShouldWaitForQuiescence(b bool) AppLaunchOption {
|
||||
opt["shouldWaitForQuiescence"] = b
|
||||
return opt
|
||||
}
|
||||
|
||||
// WithArguments The optional array of application command line arguments.
|
||||
// The arguments are going to be applied if the application was not running before.
|
||||
func (opt AppLaunchOption) WithArguments(args []string) AppLaunchOption {
|
||||
opt["arguments"] = args
|
||||
return opt
|
||||
}
|
||||
|
||||
// WithEnvironment 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 (opt AppLaunchOption) WithEnvironment(env map[string]string) AppLaunchOption {
|
||||
opt["environment"] = env
|
||||
return opt
|
||||
}
|
||||
|
||||
func (opt AppLaunchOption) WithBySelector(bySelector ...BySelector) AppLaunchOption {
|
||||
opt["bySelector"] = bySelector
|
||||
return opt
|
||||
}
|
||||
|
||||
// PasteboardType The type of the item on the pasteboard.
|
||||
type PasteboardType string
|
||||
|
||||
@@ -443,306 +396,6 @@ func (opt SourceOption) WithExcludedAttributes(attributes []string) SourceOption
|
||||
return opt
|
||||
}
|
||||
|
||||
const (
|
||||
// legacyWebElementIdentifier is the string constant used in the old
|
||||
// WebDriver JSON protocol that is the key for the map that contains an
|
||||
// unique element identifier.
|
||||
legacyWebElementIdentifier = "ELEMENT"
|
||||
|
||||
// webElementIdentifier is the string constant defined by the W3C
|
||||
// specification that is the key for the map that contains a unique element identifier.
|
||||
webElementIdentifier = "element-6066-11e4-a52e-4f735466cecf"
|
||||
)
|
||||
|
||||
func elementIDFromValue(val map[string]string) string {
|
||||
for _, key := range []string{webElementIdentifier, legacyWebElementIdentifier} {
|
||||
if v, ok := val[key]; ok && v != "" {
|
||||
return v
|
||||
}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// performance ranking: class name > accessibility id > link text > predicate > class chain > xpath
|
||||
type BySelector struct {
|
||||
ClassName ElementType `json:"class name"`
|
||||
|
||||
// isSearchByIdentifier
|
||||
Name string `json:"name"`
|
||||
Id string `json:"id"`
|
||||
AccessibilityId string `json:"accessibility id"`
|
||||
|
||||
// partialSearch
|
||||
LinkText ElementAttribute `json:"link text"`
|
||||
PartialLinkText ElementAttribute `json:"partial link text"`
|
||||
// partialSearch
|
||||
|
||||
Predicate string `json:"predicate string"`
|
||||
|
||||
ClassChain string `json:"class chain"`
|
||||
|
||||
XPath string `json:"xpath"` // not recommended, it's slow because it is not supported by XCTest natively
|
||||
|
||||
// Set the search criteria to match the given resource ResourceIdID.
|
||||
ResourceIdID string `json:"id"`
|
||||
// Set the search criteria to match the content-description property for a widget.
|
||||
ContentDescription string `json:"accessibility id"`
|
||||
|
||||
UiAutomator string `json:"-android uiautomator"`
|
||||
}
|
||||
|
||||
func (wl BySelector) getUsingAndValue() (using, value string) {
|
||||
vBy := reflect.ValueOf(wl)
|
||||
tBy := reflect.TypeOf(wl)
|
||||
for i := 0; i < vBy.NumField(); i++ {
|
||||
vi := vBy.Field(i).Interface()
|
||||
switch vi := vi.(type) {
|
||||
case ElementType:
|
||||
value = vi.String()
|
||||
case string:
|
||||
value = vi
|
||||
case ElementAttribute:
|
||||
value = vi.String()
|
||||
}
|
||||
if value != "" && value != "UNKNOWN" {
|
||||
using = tBy.Field(i).Tag.Get("json")
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (by BySelector) getMethodAndSelector() (method, selector string) {
|
||||
vBy := reflect.ValueOf(by)
|
||||
tBy := reflect.TypeOf(by)
|
||||
for i := 0; i < vBy.NumField(); i++ {
|
||||
vi := vBy.Field(i).Interface()
|
||||
// switch vi := vi.(type) {
|
||||
// case string:
|
||||
// selector = vi
|
||||
// }
|
||||
selector = vi.(string)
|
||||
if selector != "" && selector != "UNKNOWN" {
|
||||
method = tBy.Field(i).Tag.Get("json")
|
||||
return
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
type ElementAttribute map[string]interface{}
|
||||
|
||||
func (ea ElementAttribute) String() string {
|
||||
for k, v := range ea {
|
||||
switch v := v.(type) {
|
||||
case bool:
|
||||
return k + "=" + strconv.FormatBool(v)
|
||||
case string:
|
||||
return k + "=" + v
|
||||
default:
|
||||
return k + "=" + fmt.Sprintf("%v", v)
|
||||
}
|
||||
}
|
||||
return "UNKNOWN"
|
||||
}
|
||||
|
||||
func (ea ElementAttribute) getAttributeName() string {
|
||||
for k := range ea {
|
||||
return k
|
||||
}
|
||||
return "UNKNOWN"
|
||||
}
|
||||
|
||||
func NewElementAttribute() ElementAttribute {
|
||||
return make(ElementAttribute)
|
||||
}
|
||||
|
||||
// WithUID Element's unique identifier
|
||||
func (ea ElementAttribute) WithUID(uid string) ElementAttribute {
|
||||
ea["UID"] = uid
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithAccessibilityContainer Whether element is an accessibility container
|
||||
// (contains children of any depth that are accessible)
|
||||
func (ea ElementAttribute) WithAccessibilityContainer(b bool) ElementAttribute {
|
||||
ea["accessibilityContainer"] = b
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithAccessible Whether element is accessible
|
||||
func (ea ElementAttribute) WithAccessible(b bool) ElementAttribute {
|
||||
ea["accessible"] = b
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithEnabled Whether element is enabled
|
||||
func (ea ElementAttribute) WithEnabled(b bool) ElementAttribute {
|
||||
ea["enabled"] = b
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithLabel Element's label
|
||||
func (ea ElementAttribute) WithLabel(s string) ElementAttribute {
|
||||
ea["label"] = s
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithName Element's name
|
||||
func (ea ElementAttribute) WithName(s string) ElementAttribute {
|
||||
ea["name"] = s
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithSelected Element's selected state
|
||||
func (ea ElementAttribute) WithSelected(b bool) ElementAttribute {
|
||||
ea["selected"] = b
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithType Element's type
|
||||
func (ea ElementAttribute) WithType(elemType ElementType) ElementAttribute {
|
||||
ea["type"] = elemType
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithValue Element's value
|
||||
func (ea ElementAttribute) WithValue(s string) ElementAttribute {
|
||||
ea["value"] = s
|
||||
return ea
|
||||
}
|
||||
|
||||
// WithVisible
|
||||
//
|
||||
// Whether element is visible
|
||||
func (ea ElementAttribute) WithVisible(b bool) ElementAttribute {
|
||||
ea["visible"] = b
|
||||
return ea
|
||||
}
|
||||
|
||||
func (et ElementType) String() string {
|
||||
vBy := reflect.ValueOf(et)
|
||||
tBy := reflect.TypeOf(et)
|
||||
for i := 0; i < vBy.NumField(); i++ {
|
||||
if vBy.Field(i).Bool() {
|
||||
return tBy.Field(i).Tag.Get("json")
|
||||
}
|
||||
}
|
||||
return "UNKNOWN"
|
||||
}
|
||||
|
||||
// ElementType
|
||||
// !!! This mapping should be updated if there are changes after each new XCTest release"`
|
||||
type ElementType 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"`
|
||||
EditText bool `json:"android.widget.EditText"`
|
||||
}
|
||||
|
||||
// ProtectedResource A system resource that requires user authorization to access.
|
||||
type ProtectedResource int
|
||||
|
||||
// https://developer.apple.com/documentation/xctest/xcuiprotectedresource?language=objc
|
||||
const (
|
||||
ProtectedResourceContacts ProtectedResource = 1
|
||||
ProtectedResourceCalendar ProtectedResource = 2
|
||||
ProtectedResourceReminders ProtectedResource = 3
|
||||
ProtectedResourcePhotos ProtectedResource = 4
|
||||
ProtectedResourceMicrophone ProtectedResource = 5
|
||||
ProtectedResourceCamera ProtectedResource = 6
|
||||
ProtectedResourceMediaLibrary ProtectedResource = 7
|
||||
ProtectedResourceHomeKit ProtectedResource = 8
|
||||
ProtectedResourceSystemRootDirectory ProtectedResource = 0x40000000
|
||||
ProtectedResourceUserDesktopDirectory ProtectedResource = 0x40000001
|
||||
ProtectedResourceUserDownloadsDirectory ProtectedResource = 0x40000002
|
||||
ProtectedResourceUserDocumentsDirectory ProtectedResource = 0x40000003
|
||||
ProtectedResourceBluetooth ProtectedResource = -0x40000000
|
||||
ProtectedResourceKeyboardNetwork ProtectedResource = -0x40000001
|
||||
ProtectedResourceLocation ProtectedResource = -0x40000002
|
||||
ProtectedResourceHealth ProtectedResource = -0x40000003
|
||||
)
|
||||
|
||||
type Condition func(wd WebDriver) (bool, error)
|
||||
|
||||
type Direction string
|
||||
@@ -968,55 +621,16 @@ type WebDriver interface {
|
||||
WindowSize() (Size, error)
|
||||
Screen() (Screen, error)
|
||||
Scale() (float64, error)
|
||||
ActiveAppInfo() (AppInfo, error)
|
||||
// ActiveAppsList Retrieves the information about the currently active apps
|
||||
ActiveAppsList() ([]AppBaseInfo, 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
|
||||
AppState(bundleId string) (AppState, error)
|
||||
|
||||
// IsLocked Checks if the screen is locked or not.
|
||||
IsLocked() (bool, 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.
|
||||
Unlock() 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.
|
||||
Lock() error
|
||||
|
||||
// Homescreen Forces the device under test to switch to the home screen
|
||||
Homescreen() error
|
||||
|
||||
// AlertText Returns alert's title and description separated by new lines
|
||||
AlertText() (string, error)
|
||||
// AlertButtons Gets the labels of the buttons visible in the alert
|
||||
AlertButtons() ([]string, error)
|
||||
// AlertAccept Accepts alert, if present
|
||||
AlertAccept(label ...string) error
|
||||
// AlertDismiss Dismisses alert, if present
|
||||
AlertDismiss(label ...string) error
|
||||
// AlertSendKeys Types a text into an input inside the alert container, if it is present
|
||||
AlertSendKeys(text string) error
|
||||
|
||||
// AppLaunch Launch an application with given bundle identifier in scope of current session.
|
||||
// !This method is only available since Xcode9 SDK
|
||||
AppLaunch(bundleId string, launchOpt ...AppLaunchOption) error
|
||||
// AppLaunchUnattached Launch the app with the specified bundle ID.
|
||||
AppLaunchUnattached(bundleId string) error
|
||||
AppLaunch(bundleId string) error
|
||||
// AppTerminate Terminate an application with the given bundle id.
|
||||
// Either `true` if the app has been successfully terminated or `false` if it was not running
|
||||
AppTerminate(bundleId string) (bool, error)
|
||||
// AppActivate Activate an application with given bundle identifier in scope of current session.
|
||||
// !This method is only available since Xcode9 SDK
|
||||
AppActivate(bundleId string) error
|
||||
// AppDeactivate Deactivates application for given time and then activate it again
|
||||
// The minimum application switch wait is 3 seconds
|
||||
AppDeactivate(second float64) error
|
||||
|
||||
// AppAuthReset Resets the authorization status for a protected resource. Available since Xcode 11.4
|
||||
AppAuthReset(ProtectedResource) error
|
||||
|
||||
// StartCamera Starts a new camera for recording
|
||||
StartCamera() error
|
||||
@@ -1045,13 +659,6 @@ type WebDriver interface {
|
||||
Swipe(fromX, fromY, toX, toY int, options ...DataOption) error
|
||||
SwipeFloat(fromX, fromY, toX, toY float64, options ...DataOption) error
|
||||
|
||||
ForceTouch(x, y int, pressure float64, second ...float64) error
|
||||
ForceTouchFloat(x, y, pressure float64, second ...float64) error
|
||||
|
||||
// PerformW3CActions Perform complex touch action in scope of the current application.
|
||||
PerformW3CActions(actions *W3CActions) error
|
||||
PerformAppiumTouchActions(touchActs *TouchActions) error
|
||||
|
||||
// SetPasteboard Sets data to the general pasteboard
|
||||
SetPasteboard(contentType PasteboardType, content string) error
|
||||
// GetPasteboard Gets the data contained in the general pasteboard.
|
||||
@@ -1066,45 +673,12 @@ type WebDriver interface {
|
||||
// Input works like SendKeys
|
||||
Input(text string, options ...DataOption) error
|
||||
|
||||
// KeyboardDismiss Tries to dismiss the on-screen keyboard
|
||||
KeyboardDismiss(keyNames ...string) error
|
||||
|
||||
// PressButton Presses the corresponding hardware button on the device
|
||||
PressButton(devBtn DeviceButton) error
|
||||
|
||||
// PressBack Presses the back button
|
||||
PressBack(options ...DataOption) error
|
||||
|
||||
// IOHIDEvent Emulated triggering of the given low-level IOHID device event.
|
||||
// duration: The event duration in float seconds (XCTest uses 0.005 for a single press event)
|
||||
IOHIDEvent(pageID EventPageID, usageID EventUsageID, duration ...float64) error
|
||||
|
||||
// ExpectNotification Creates an expectation that is fulfilled when an expected Notification is received
|
||||
ExpectNotification(notifyName string, notifyType NotificationType, second ...int) error
|
||||
|
||||
// SiriActivate Activates Siri service voice recognition with the given text to parse
|
||||
SiriActivate(text string) error
|
||||
// SiriOpenUrl Opens the particular url scheme using Siri voice recognition helpers.
|
||||
// !This will only work since XCode 8.3/iOS 10.3
|
||||
// It doesn't actually work, right?
|
||||
SiriOpenUrl(url string) error
|
||||
|
||||
Orientation() (Orientation, error)
|
||||
// SetOrientation Sets requested device interface orientation.
|
||||
SetOrientation(Orientation) error
|
||||
|
||||
Rotation() (Rotation, error)
|
||||
// SetRotation Sets the devices orientation to the rotation passed.
|
||||
SetRotation(Rotation) error
|
||||
|
||||
// MatchTouchID Matches or mismatches TouchID request
|
||||
MatchTouchID(isMatch bool) error
|
||||
|
||||
// ActiveElement Returns the element, which currently holds the keyboard input focus or nil if there are no such elements.
|
||||
ActiveElement() (WebElement, error)
|
||||
FindElement(by BySelector) (WebElement, error)
|
||||
FindElements(by BySelector) ([]WebElement, error)
|
||||
|
||||
Screenshot() (*bytes.Buffer, error)
|
||||
|
||||
// Source Return application elements tree
|
||||
@@ -1122,13 +696,6 @@ type WebDriver interface {
|
||||
|
||||
IsHealthy() (bool, error)
|
||||
|
||||
// WaitWithTimeoutAndInterval waits for the condition to evaluate to true.
|
||||
WaitWithTimeoutAndInterval(condition Condition, timeout, interval time.Duration) error
|
||||
// WaitWithTimeout works like WaitWithTimeoutAndInterval, but with default polling interval.
|
||||
WaitWithTimeout(condition Condition, timeout time.Duration) error
|
||||
// Wait works like WaitWithTimeoutAndInterval, but using the default timeout and polling interval.
|
||||
Wait(condition Condition) error
|
||||
|
||||
// Close inner connections properly
|
||||
Close() error
|
||||
|
||||
@@ -1136,94 +703,3 @@ type WebDriver interface {
|
||||
StartCaptureLog(identifier ...string) (err error)
|
||||
StopCaptureLog() (result interface{}, err error)
|
||||
}
|
||||
|
||||
// WebElement defines method supported by web elements.
|
||||
type WebElement interface {
|
||||
// Click Waits for element to become stable (not move) and performs sync tap on element.
|
||||
Click() error
|
||||
// SendKeys Types a text into element. It will try to activate keyboard on element,
|
||||
// if element has no keyboard focus.
|
||||
// frequency: Frequency of typing (letters per sec). The default value is 60
|
||||
SendKeys(text string, options ...DataOption) error
|
||||
// Clear Clears text on element. It will try to activate keyboard on element,
|
||||
// if element has no keyboard focus.
|
||||
Clear() error
|
||||
|
||||
// Tap Waits for element to become stable (not move) and performs sync tap on element,
|
||||
// relative to the current element position
|
||||
Tap(x, y int) error
|
||||
TapFloat(x, y float64) error
|
||||
|
||||
// DoubleTap Sends a double tap event to a hittable point computed for the element.
|
||||
DoubleTap() error
|
||||
|
||||
// TouchAndHold Sends a long-press gesture to a hittable point computed for the element,
|
||||
// holding for the specified duration.
|
||||
// second: The default value is 1
|
||||
TouchAndHold(second ...float64) error
|
||||
// TwoFingerTap Sends a two finger tap event to a hittable point computed for the element.
|
||||
TwoFingerTap() error
|
||||
// TapWithNumberOfTaps Sends one or more taps with one or more touch points.
|
||||
TapWithNumberOfTaps(numberOfTaps, numberOfTouches int) error
|
||||
// ForceTouch Waits for element to become stable (not move) and performs sync force touch on element.
|
||||
// second: The default value is 1
|
||||
ForceTouch(pressure float64, second ...float64) error
|
||||
// ForceTouchFloat works like ForceTouch, but relative to the current element position
|
||||
ForceTouchFloat(x, y, pressure float64, second ...float64) error
|
||||
|
||||
// Drag Initiates a press-and-hold gesture at the coordinate, then drags to another coordinate.
|
||||
// relative to the current element position
|
||||
// pressForDuration: The default value is 1 second.
|
||||
Drag(fromX, fromY, toX, toY int, pressForDuration ...float64) error
|
||||
DragFloat(fromX, fromY, toX, toY float64, pressForDuration ...float64) error
|
||||
|
||||
// Swipe works like Drag, but `pressForDuration` value is 0.
|
||||
// relative to the current element position
|
||||
Swipe(fromX, fromY, toX, toY int) error
|
||||
SwipeFloat(fromX, fromY, toX, toY float64) error
|
||||
// SwipeDirection Performs swipe gesture on the element.
|
||||
// velocity: swipe speed in pixels per second. Custom velocity values are only supported since Xcode SDK 11.4.
|
||||
SwipeDirection(direction Direction, velocity ...float64) error
|
||||
|
||||
// Pinch Sends a pinching gesture with two touches.
|
||||
// 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.
|
||||
// velocity: The velocity of the pinch in scale factor per second.
|
||||
Pinch(scale, velocity float64) error
|
||||
PinchToZoomOutByW3CAction(scale ...float64) error
|
||||
|
||||
// Rotate Sends a rotation gesture with two touches.
|
||||
// rotation: The rotation of the gesture in radians.
|
||||
// velocity: The velocity of the rotation gesture in radians per second.
|
||||
Rotate(rotation float64, velocity ...float64) error
|
||||
|
||||
// PickerWheelSelect
|
||||
// offset: The default value is 2
|
||||
PickerWheelSelect(order PickerWheelOrder, offset ...int) error
|
||||
|
||||
ScrollElementByName(name string) error
|
||||
ScrollElementByPredicate(predicate string) error
|
||||
ScrollToVisible() error
|
||||
// ScrollDirection
|
||||
// distance: The default value is 0.5
|
||||
ScrollDirection(direction Direction, distance ...float64) error
|
||||
|
||||
FindElement(by BySelector) (element WebElement, err error)
|
||||
FindElements(by BySelector) (elements []WebElement, err error)
|
||||
FindVisibleCells() (elements []WebElement, err error)
|
||||
|
||||
Rect() (rect Rect, err error)
|
||||
Location() (Point, error)
|
||||
Size() (Size, error)
|
||||
Text() (text string, err error)
|
||||
Type() (elemType string, err error)
|
||||
IsEnabled() (enabled bool, err error)
|
||||
IsDisplayed() (displayed bool, err error)
|
||||
IsSelected() (selected bool, err error)
|
||||
IsAccessible() (accessible bool, err error)
|
||||
IsAccessibilityContainer() (isAccessibilityContainer bool, err error)
|
||||
GetAttribute(attr ElementAttribute) (value string, err error)
|
||||
UID() (uid string)
|
||||
|
||||
Screenshot() (raw *bytes.Buffer, err error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user