change: update DataOptions

This commit is contained in:
xucong.053
2022-10-17 14:32:28 +08:00
parent 2df2792fe4
commit 0e248882b1
10 changed files with 159 additions and 184 deletions
+5 -10
View File
@@ -29,16 +29,11 @@ func (ue uiaElement) SendKeys(text string, options ...DataOption) (err error) {
"text": text,
}
// append options in post data for extra uiautomator configurations
for _, option := range options {
option(data)
}
// new data options in post data for extra uiautomator configurations
d := NewData(options...)
d.MergeData(data)
if _, ok := data["isReplace"]; !ok {
data["isReplace"] = true // default true
}
_, err = ue.parent.httpPOST(data, "/session", ue.parent.sessionId, "/element", ue.id, "/value")
_, err = ue.parent.httpPOST(d.Data, "/session", ue.parent.sessionId, "/element", ue.id, "/value")
return
}
@@ -113,7 +108,7 @@ func (ue uiaElement) Swipe(fromX, fromY, toX, toY int) error {
func (ue uiaElement) SwipeFloat(fromX, fromY, toX, toY float64) error {
options := []DataOption{
WithStepsOption(12),
WithDataSteps(12),
WithCustomOption("elementId", ue.id),
}
return ue.parent._swipe(fromX, fromY, toX, toY, options...)