module.exports.tapElementByXPath = function()

in lib/appium/helpers/wdHelper.js [182:200]


module.exports.tapElementByXPath = function (xpath, driver) {
    return driver
        .waitForElementByXPath(xpath, 30000)
        .getLocation()
        .then(function (loc) {
            if (loc.x <= 0) loc.x = 1;
            if (loc.y <= 0) loc.y = 1;

            loc.x = Math.floor(loc.x + 1);
            loc.y = Math.floor(loc.y + 1);

            const wd = module.exports.getWD();
            const tapElement = new wd.TouchAction();

            tapElement.tap(loc);

            return driver.performTouchAction(tapElement);
        });
};