You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by al...@apache.org on 2016/04/29 16:49:02 UTC

cordova-medic git commit: CB-11175 Appium runner: added tapElementByXPath function to wdHelper

Repository: cordova-medic
Updated Branches:
  refs/heads/master 01a43ab5c -> bed55f473


CB-11175 Appium runner: added tapElementByXPath function to wdHelper


Project: http://git-wip-us.apache.org/repos/asf/cordova-medic/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-medic/commit/bed55f47
Tree: http://git-wip-us.apache.org/repos/asf/cordova-medic/tree/bed55f47
Diff: http://git-wip-us.apache.org/repos/asf/cordova-medic/diff/bed55f47

Branch: refs/heads/master
Commit: bed55f47334ec0d6a5544fca2b57de95f79cf50d
Parents: 01a43ab
Author: Alexander Sorokin <al...@akvelon.com>
Authored: Fri Apr 29 14:28:07 2016 +0300
Committer: Alexander Sorokin <al...@akvelon.com>
Committed: Fri Apr 29 17:47:39 2016 +0300

----------------------------------------------------------------------
 lib/appium/helpers/wdHelper.js | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-medic/blob/bed55f47/lib/appium/helpers/wdHelper.js
----------------------------------------------------------------------
diff --git a/lib/appium/helpers/wdHelper.js b/lib/appium/helpers/wdHelper.js
index f06913f..766e2ee 100644
--- a/lib/appium/helpers/wdHelper.js
+++ b/lib/appium/helpers/wdHelper.js
@@ -131,3 +131,22 @@ module.exports.configureLogging = function (driver) {
         console.log(' > ' + meth, path, data || '');
     });
 };
+
+module.exports.tapElementByXPath = function (xpath, driver) {
+    return driver
+        .waitForElementByXPath(xpath, 60000)
+        .getLocation()
+        .then(function (loc) {
+            if (loc.x <= 0) {
+                loc.x = 1;
+            }
+            if (loc.y <= 0) {
+                loc.y = 1;
+            }
+            var wd = module.exports.getWD();
+            var tapChoose = new wd.TouchAction();
+            tapChoose.tap(loc);
+            return driver
+                .performTouchAction(tapChoose);
+        });
+};


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org