Created
November 27, 2014 20:53
-
-
Save thu2004/1980155888eb677a37bd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Selendroid.prototype.pinchClose = function (startX, startY, endX, endY, duration, | |
percent, steps, elId, cb) { | |
var command; | |
var fromPointObject = {'x' : startX, 'y' : startY}; | |
var toPointObject = {'x' : endX, 'y' : endY}; | |
var moveX = (endX - startX)/4 | |
var moveY = (endY - startY)/4 | |
if (elId) { | |
return cb(new NotYetImplementedError(), null); | |
} | |
var reqUrl = this.proxyHost + ':' + this.proxyPort + | |
'/wd/hub/session/' + this.proxySessionId + | |
'/actions/'; | |
var json_v = | |
{"payload":[ | |
{"id":"","inputDevice":"touch", | |
"actions":[ | |
{"name":"pointerDown","y":startY,"x":startX}, | |
{"name":"pause","ms":1000}, | |
{"name":"pointerMove","y":startY,"x":startX+moveX}, | |
{"name":"pointerUp"} | |
]}, | |
{"id":"","inputDevice":"touch", | |
"actions":[ | |
{"name":"pointerDown","y":endY,"x":endX}, | |
{"name":"pause","ms":1000}, | |
{"name":"pointerMove","y":endY,"x":endX-moveX}, | |
{"name":"pointerUp"} | |
]} | |
]}; | |
doRequest(reqUrl, 'POST', json_v, null, function (err) { | |
if (err) return cb(err); | |
cb(null, { | |
status: status.codes.Success.code, | |
value: '' | |
}); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment