I wanted to include one more test (not used in this application) that I have written in the past for a different project since this will give you an idea of just how powerful Appium can be:
it("should type in an element", function (done) { driver .elementByXPath('//' + nsAppium.getXPathElement("EditText") + "[@text='Enter your name']") .sendKeys('Testing') .text() .then(function (v) { if ('Testing' !== v) { done(new Error("Value in name field does not match")); } else { done(); } }, done); });});
The first thing you might note is that I did not return the promise chain. That is because this example shows how to use the asynchronous support of it. For an async support, you can use a promise or make the function coming ...