I’m working with the Inspector to write some tests for iOS. We’re checking out an iPhone 6, version 8.4. Every time I try to run the tests after setting them up in the inspector, I keep getting the error that element cannot be found using the parameters used. Also, while using inspector, I am able to click buttons (like a login button, or “facebook” button, but sending text to text fields never works. Could really use some guidance here.
“use strict”;
var wd = require(“wd”);
var chai = require(“chai”);
var chaiAsPromised = require(“chai-as-promised”);
chai.use(chaiAsPromised);
chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
var desired = {
“appium-version”: “1.0”,
platformName: “iOS”,
platformVersion: “8.4”,
deviceName: “iPhone 6”,
app: “/Users/andrew/Documents/SqorMobileiOS.app”,
};
var browser = wd.promiseChainRemote(“0.0.0.0”, 4723);
browser.init(desired).then(function() {
return browser
.elementByXPath("//UIAApplication[1]/UIAWindow[1]/UIAButton[1]").click()
.sleep(10000)
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]").click()
.sleep(10000)
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]").sendKeys("[email protected]")
.sleep(10000)
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIASecureTextField[1]").click()
.elementByXPath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIASecureTextField[1]").sendKeys(“Password”)
.elementByXPath(" //UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIAButton[1]").click()
.sleep(10000)
.fin(function() {
return browser.quit();
});
}).done();