Element could not be located in protractor scripts using appium

I want to automate my tests for an Angular JS site using Ipad Air simulator, appium and protractor but the problem that the test couldn’t be passed successfully, it tells me that element couldn’t be located and i’m sure about the xpath it’s the same generated by appium.

This is my config file
​exports.config = {
allScriptsTimeout: 600000,
seleniumAddress: ‘http://0.0.0.0:4723/wd/hub’,

specs: [
‘testsuite/test3.js’
],

capabilities: {
browserName: ‘safari’,
‘appium-version’: ‘1.4.13’,
platformName: ‘iOS’,
platformVersion: ‘9.3’,
deviceName: ‘iPad Air’
},

chromeOnly: false,

baseUrl: ‘http://10.0.22.82:4180/jws/fetablet_dev_T1000’,

framework:[
‘jasmine’
],

mochaOpts: {

defaultTimeoutInterval:1000000

}
};
My test3.js file contain

“use strict”;
var wd = require(“wd”);
var chai = require(“chai”);
var chaiAsPromised = require(“chai-as-promised”);

chai.use(chaiAsPromised);

var expect = chai.expect;

chai.should();
chaiAsPromised.transferPromiseness = wd.transferPromiseness;

describe(‘my app’, function() {

it(‘should make the login test’,function() {

var desired = {
browserName: ‘safari’,
platformName:‘iOS’,
name:“This is an example for login test”
}
browser.ignoresynchronization=true;
browser.get(“0.22.82:4180/jws/fetablet_dev_T1000”);

browser.driver.findelement(by.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]")).sendKeys(“RET02”);

});

});

And this is the error

try:

browser.driver.
   findelement(by.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]")).
   then((elem) => elem.sendKeys("RET02"));

Thanks for your answer, now i have a new problem the web site isn’t loaded totally and i got the error that : No element found using locator : by.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIA‌​WebView[1]/UIATextField[1]"))

increase timeout to wait more time

Yes i make in browser.get(address, 80000)

right after fail try to get pagesource what is loaded and check if xPath you looking for is loaded

1 Like

The problem even if i make a big time out ! the browser is closed immediately when the url was opened as if the ipad simulator get crashed. So may be it doesn’t get the chance to find the element by xpath

so you need find out reason of crash first

1 Like

I got in appium log responding to client with success after that crash, here my appium log. Thanks for helping me.

​[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute {"script":"return window.location.href;","args":[]}
[MJSONWP] Calling AppiumDriver.execute() with args: ["return window.location.href;",[],"04efb027-9ff4-4743-8280-744365d0fab1"]​​
[debug] [iOS] Executing iOS command 'execute'
[debug] [RemoteDebugger] Executing 'exe​​cute_script' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Received applicationSentData response
​​[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":"http:/...'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'execute_script' execution: "http://10.0.22.82:8080/jws/fetablet/"
[MJSONWP] Responding to client with driver.execute() result: "http://10.0.22.82:8080/jws/fetablet/"
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute 200 510 ms - 110 
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute_async {"script":"try { return (function (attempts, asyncCallback) {\n  var callback = function(args) {\n    setTimeout(function() {\n      asyncCallback(args);\n    }, 0);\n  };\n  var check = function(n) {\n    try {\n      if (window.getAllAngularTestabilities) {\n        callback({ver: 2});\n      } else if (window.angular && window.angular.resumeBootstrap) {\n        callback({ver: 1});\n      } else if (n < 1) {\n        if (window.angular) {\n          callback({message: 'angular never provided resumeBootstrap'});\n        } else {\n          callback({message: 'retries looking for angular exceeded'});\n        }\n      } else {\n        window.setTimeout(function() {check(n - 1);}, 1000);\n      }\n    } catch (e) {\n      callback({message: e});\n    }\n  };\n  check(attempts);\n}).apply(this, arguments); }\ncatch(e) { throw (e instanceof Error) ? e : new Error(e); }","args":[80]}
[MJSONWP] Calling AppiumDriver.executeAsync() with args: ["try { return (function (attempts, asyncCallback) {\n  var callback = function(args) {\n    setTimeout(function() {\n      asyncCallback(args);\n ...
[debug] [iOS] Executing iOS command 'executeAsync'
[debug] [iOS] Response url for executeAsync: http://0.0.0.0:4723/wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response
[debug] [RemoteDebugger] Executing 'execute_async_script' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"result":{"type":"undefine...'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [iOS] atom did not return yet, checking to see if we are blocked by an alert
[debug] [UIAuto] Sending command to instruments: au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:18:57 +0000 Debug: Got new command 13 from instruments: au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:18:57 +0000 Debug: evaluating au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:18:58 +0000 Debug: evaluation finished
[debug] [Instruments] [INST] 2016-04-15 10:18:58 +0000 Debug: responding with:
[debug] [Instruments] [INST] 2016-04-15 10:18:58 +0000 Debug: Running system command #14: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js /var/folders/hy/db81jfkn23x5jxsmdnk_d_8h0000gr/T/instruments_sock 2,{"status":0,"value":false}...
[debug] [UIAuto] Socket data received (28 bytes)
[debug] [UIAuto] Got result from instruments: {"status":0,"value":false}
[debug] [iOS] No alert found.
[debug] [iOS] atom did not return yet, checking to see if we are blocked by an alert
[debug] [UIAuto] Sending command to instruments: au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:18:59 +0000 Debug: Got new command 14 from instruments: au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:18:59 +0000 Debug: evaluating au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:18:59 +0000 Debug: evaluation finished
[debug] [Instruments] [INST] 2016-04-15 10:18:59 +0000 Debug: responding with:
[debug] [Instruments] [INST] 2016-04-15 10:18:59 +0000 Debug: Running system command #15: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js /var/folders/hy/db81jfkn23x5jxsmdnk_d_8h0000gr/T/instruments_sock 2,{"status":0,"value":false}...
[debug] [UIAuto] Socket data received (28 bytes)
[debug] [UIAuto] Got result from instruments: {"status":0,"value":false}
[debug] [iOS] No alert found.
[debug] [iOS] atom did not return yet, checking to see if we are blocked by an alert
[debug] [UIAuto] Sending command to instruments: au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:19:00 +0000 Debug: Got new command 15 from instruments: au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:19:00 +0000 Debug: evaluating au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:19:00 +0000 Debug: evaluation finished
[debug] [Instruments] [INST] 2016-04-15 10:19:00 +0000 Debug: responding with:
[debug] [Instruments] [INST] 2016-04-15 10:19:00 +0000 Debug: Running system command #16: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js /var/folders/hy/db81jfkn23x5jxsmdnk_d_8h0000gr/T/instruments_sock 2,{"status":0,"value":false}...
[debug] [UIAuto] Socket data received (28 bytes)
[debug] [UIAuto] Got result from instruments: {"status":0,"value":false}
[debug] [iOS] No alert found.
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Got a blank data response from debugger
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Got a blank data response from debugger
[HTTP] <-- OPTIONS /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response 200 1 ms - 2 
[debug] [iOS] atom did not return yet, checking to see if we are blocked by an alert
[debug] [UIAuto] Sending command to instruments: au.alertIsPresent()
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response {"status":0,"value":{"ver":1}}
[MJSONWP] Calling AppiumDriver.receiveAsyncResponse() with args: [0,{"ver":1},"04efb027-9ff4-4743-8280-744365d0fab1"]
[debug] [iOS] Executing iOS command 'receiveAsyncResponse'
[debug] [iOS] Received async response: {"ver":1}
[MJSONWP] Responding to client with driver.receiveAsyncResponse() result: null
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response 200 3 ms - 76 
[debug] [Instruments] [INST] 2016-04-15 10:19:01 +0000 Debug: Got new command 16 from instruments: au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:19:01 +0000 Debug: evaluating au.alertIsPresent()
[debug] [Instruments] [INST] 2016-04-15 10:19:01 +0000 Debug: evaluation finished
[debug] [Instruments] [INST] 2016-04-15 10:19:01 +0000 Debug: responding with:
[debug] [Instruments] [INST] 2016-04-15 10:19:01 +0000 Debug: Running system command #17: /usr/local/bin/node /usr/local/lib/node_modules/appium/node_modules/appium-ios-driver/node_modules/appium-uiauto/build/lib/bin/command-proxy-client.js /var/folders/hy/db81jfkn23x5jxsmdnk_d_8h0000gr/T/instruments_sock 2,{"status":0,"value":false}...
[debug] [UIAuto] Socket data received (28 bytes)
[debug] [UIAuto] Got result from instruments: {"status":0,"value":false}
[debug] [iOS] No alert found.
[MJSONWP] Responding to client with driver.executeAsync() result: {"ver":1}
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute_async 200 4832 ms - 81 
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute {"script":"return (function (trackOutstandingTimeouts) {\n    var ngMod = angular.module('protractorBaseModule_', []).\n        config(['$compileProvider', function($compileProvider) {\n          if ($compileProvider.debugInfoEnabled) {\n            $compileProvider.debugInfoEnabled(true);\n          }\n        }]);\n    if (trackOutstandingTimeouts) {\n      ngMod.config(['$provide', function($provide) {\n          $provide.decorator('$timeout', ['$delegate', function($delegate) {\n            var $timeout = $delegate;\n\n            var taskId = 0;\n            if (!window.NG_PENDING_TIMEOUTS) {\n              window.NG_PENDING_TIMEOUTS = {};\n            }\n              \n            var extendedTimeout = function() {\n              var args = Array.prototype.slice.call(arguments);\n              if (typeof(args[0]) !== 'function') {\n                return $timeout.apply(null, args);\n              }\n\n              taskId++;\n              var fn = args[0];\n              window
[MJSONWP] Calling AppiumDriver.execute() with args: ["return (function (trackOutstandingTimeouts) {\n    var ngMod = angular.module('protractorBaseModule_', []).\n        config(['$compileProvider', ...
[debug] [iOS] Executing iOS command 'execute'
[debug] [RemoteDebugger] Executing 'execute_script' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":null}'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'execute_script' execution: null
[MJSONWP] Responding to client with driver.execute() result: null
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute 200 512 ms - 76 
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute {"script":"angular.resumeBootstrap(arguments[0]);","args":[["protractorBaseModule_"]]}
[MJSONWP] Calling AppiumDriver.execute() with args: ["angular.resumeBootstrap(arguments[0]);",[["protractorBaseModule_"]],"04efb027-9ff4-4743-8280-744365d0fab1"]
[debug] [iOS] Executing iOS command 'execute'
[debug] [RemoteDebugger] Executing 'execute_script' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"status":0,"value":null}'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'execute_script' execution: null
[MJSONWP] Responding to client with driver.execute() result: null
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute 200 562 ms - 76 
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute_async {"script":"try { return (function (rootSelector, callback) {\n  var el = document.querySelector(rootSelector);\n\n  try {\n    if (window.getAngularTestability) {\n      window.getAngularTestability(el).whenStable(callback);\n      return;\n    }\n    if (!window.angular) {\n      throw new Error('window.angular is undefined.  This could be either ' +\n          'because this is a non-angular page or because your test involves ' +\n          'client-side navigation, which can interfere with Protractor\\'s ' +\n          'bootstrapping.  See http://git.io/v4gXM for details');\n    }\n    if (angular.getTestability) {\n      angular.getTestability(el).whenStable(callback);\n    } else {\n      if (!angular.element(el).injector()) {\n        throw new Error('root element (' + rootSelector + ') has no injector.' +\n           ' this may mean it is not inside ng-app.');\n      }\n      angular.element(el).injector().get('$browser').\n          notifyWhenNoOutstandingRequests(callback);\n   
[MJSONWP] Calling AppiumDriver.executeAsync() with args: ["try { return (function (rootSelector, callback) {\n  var el = document.querySelector(rootSelector);\n\n  try {\n    if (window.getAngularTestabil...
[debug] [iOS] Executing iOS command 'executeAsync'
[debug] [iOS] Response url for executeAsync: http://0.0.0.0:4723/wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response
[debug] [RemoteDebugger] Executing 'execute_async_script' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"result":{"type":"undefine...'
[debug] [RemoteDebugger] Original command: sendJSCommand
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response {"status":0,"value":null}
[MJSONWP] Calling AppiumDriver.receiveAsyncResponse() with args: [0,null,"04efb027-9ff4-4743-8280-744365d0fab1"]
[debug] [iOS] Executing iOS command 'receiveAsyncResponse'
[debug] [iOS] Received async response: null
[MJSONWP] Responding to client with driver.receiveAsyncResponse() result: null
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response 200 5 ms - 76 
[MJSONWP] Responding to client with driver.executeAsync() result: null
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute_async 200 743 ms - 76 
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/elements {"using":"xpath","value":"//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]"}
[MJSONWP] Calling AppiumDriver.findElements() with args: ["xpath","//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]","04efb027-9ff4-4743-8280-744365d0fab1"]
[debug] [iOS] Executing iOS command 'findElements'
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [RemoteDebugger] Executing 'find_elements' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '"{\"status\":0,\"value\":[]}"'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'find_elements' execution: []
[MJSONWP] Responding to client with driver.findElements() result: []
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/elements 200 551 ms - 74 
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute_async {"script":"try { return (function (rootSelector, callback) {\n  var el = document.querySelector(rootSelector);\n\n  try {\n    if (window.getAngularTestability) {\n      window.getAngularTestability(el).whenStable(callback);\n      return;\n    }\n    if (!window.angular) {\n      throw new Error('window.angular is undefined.  This could be either ' +\n          'because this is a non-angular page or because your test involves ' +\n          'client-side navigation, which can interfere with Protractor\\'s ' +\n          'bootstrapping.  See http://git.io/v4gXM for details');\n    }\n    if (angular.getTestability) {\n      angular.getTestability(el).whenStable(callback);\n    } else {\n      if (!angular.element(el).injector()) {\n        throw new Error('root element (' + rootSelector + ') has no injector.' +\n           ' this may mean it is not inside ng-app.');\n      }\n      angular.element(el).injector().get('$browser').\n          notifyWhenNoOutstandingRequests(callback);\n   
[MJSONWP] Calling AppiumDriver.executeAsync() with args: ["try { return (function (rootSelector, callback) {\n  var el = document.querySelector(rootSelector);\n\n  try {\n    if (window.getAngularTestabil...
[debug] [iOS] Executing iOS command 'executeAsync'
[debug] [iOS] Response url for executeAsync: http://0.0.0.0:4723/wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response
[debug] [RemoteDebugger] Executing 'execute_async_script' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response {"status":0,"value":null}
[MJSONWP] Calling AppiumDriver.receiveAsyncResponse() with args: [0,null,"04efb027-9ff4-4743-8280-744365d0fab1"]
[debug] [iOS] Executing iOS command 'receiveAsyncResponse'
[debug] [iOS] Received async response: null
[MJSONWP] Responding to client with driver.receiveAsyncResponse() result: null
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/receive_async_response 200 3 ms - 76 
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '{"result":{"type":"undefine...'
[debug] [RemoteDebugger] Original command: sendJSCommand
[MJSONWP] Responding to client with driver.executeAsync() result: null
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/execute_async 200 528 ms - 76 
[HTTP] --> POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/elements {"using":"xpath","value":"//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[2]"}
[MJSONWP] Calling AppiumDriver.findElements() with args: ["xpath","//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIAStaticText[2]","04efb027-9ff4-4743-8280-744365d0fab1"]
[debug] [iOS] Executing iOS command 'findElements'
[debug] [BaseDriver] Waiting up to 0 ms for condition
[debug] [RemoteDebugger] Executing 'find_elements' atom in default context
[debug] [RemoteDebugger] Sending javascript command (function(){return function...
[debug] [RemoteDebugger] Sending '_rpc_forwardSocketData:' message to remote debugger
[debug] [RemoteDebugger] Received applicationSentData response
[debug] [RemoteDebugger] Found data handler for response
[debug] [RemoteDebugger] Received data response from socket send: '"{\"status\":0,\"value\":[]}"'
[debug] [RemoteDebugger] Original command: sendJSCommand
[debug] [RemoteDebugger] Received result for atom 'find_elements' execution: []
[MJSONWP] Responding to client with driver.findElements() result: []
[HTTP] <-- POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/elements 200 509 ms - 74 
[HTTP] --> DELETE /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1 {}
[MJSONWP] Calling AppiumDriver.deleteSession() with args: ["04efb027-9ff4-4743-8280-744365d0fab1"]
[debug] [iOS] Deleting ios session
[debug] [UIAuto] Destroying instruments client socket.
[debug] [UIAuto] Closing socket server.
[debug] [UIAuto] Instruments socket server was closed
[debug] [Instruments] Starting shutdown.
[debug] [Instruments] Sending sigterm to instruments
[debug] [Instruments] [INST] 2016-04-15 10:19:05 +0000 Stopped: Script was stopped by the user
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"__argument":{"WIRApplicationIdentifierKey":"PID:50016","WIRIsApplicationProxyKey":false,"WIRApplicationNameKey":"Safari","WIRApplicationBundleIdentifierKey":"com.apple.mobilesafari","WIRIsApplicationActiveKey":1},"__selector":"_rpc_applicationDisconnected:"}'
[debug] [RemoteDebugger] Application PID:50016 disconnected. Removing from app dictionary.
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"__argument":{"WIRApplicationIdentifierKey":"PID:50023","WIRIsApplicationProxyKey":true,"WIRApplicationNameKey":"","WIRApplicationBundleIdentifierKey":"com.apple.WebKit.WebContent","WIRIsApplicationActiveKey":1,"WIRHostApplicationIdentifierKey":"PID:50016"},"__selector":"_rpc_applicationDisconnected:"}'
[debug] [RemoteDebugger] Application PID:50023 disconnected. Removing from app dictionary.
[debug] [RemoteDebugger] No longer have app id. Attempting to find new one.
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"__argument":{"WIRApplicationIdentifierKey":"PID:50016","WIRIsApplicationProxyKey":false,"WIRApplicationNameKey":"Safari","WIRApplicationBundleIdentifierKey":"com.apple.mobilesafari","WIRIsApplicationActiveKey":1},"__selector":"_rpc_applicationDisconnected:"}'
[debug] [RemoteDebugger] Application PID:50016 disconnected. Removing from app dictionary.
[debug] [RemoteDebugger] Receiving data from remote debugger: '{"__argument":{"WIRApplicationIdentifierKey":"PID:50023","WIRIsApplicationProxyKey":true,"WIRApplicationNameKey":"","WIRApplicationBundleIdentifierKey":"com.apple.WebKit.WebContent","WIRIsApplicationActiveKey":1,"WIRHostApplicationIdentifierKey":"PID:50016"},"__selector":"_rpc_applicationDisconnected:"}'
[debug] [RemoteDebugger] Application PID:50023 disconnected. Removing from app dictionary.
[debug] [Instruments] [INST STDERR] 2016-04-15 12:19:06.612 instruments[49940:2672471] Attempting to change event horizon while disengage
[debug] [Instruments] [INST] Instruments Trace Complete (Duration : 62.623680s; Output : /var/folders/hy/db81jfkn23x5jxsmdnk_d_8h0000gr/T/appium-instruments/instrumentscli0.trace)
[debug] [Instruments] Instruments exited with code 0
[debug] [iOSLog] Stopping iOS log capture
[debug] [RemoteDebugger] Disconnecting from remote debugger
[debug] [iOS] Running ios sim reset flow
[debug] [iOS] Killing the simulator
[debug] [iOSSim] Killing all iOS Simulators
[debug] [iOS] Cleaning sim state.
[debug] [iOSSim] Killing any simulator daemons for 080DA0BE-F66E-4C1D-84C5-8C405AE6E6E1
[iOSSim] Cleaning simulator 080DA0BE-F66E-4C1D-84C5-8C405AE6E6E1
[Appium] Removing session 04efb027-9ff4-4743-8280-744365d0fab1 from our master session list
[debug] [MJSONWP] Received response: null
[debug] [MJSONWP] But deleting session, so not returning
[MJSONWP] Responding to client with driver.deleteSession() result: null

this is result of search:
[MJSONWP] Responding to client with driver.findElements() result:
[HTTP] ← POST /wd/hub/session/04efb027-9ff4-4743-8280-744365d0fab1/elements 200 509 ms - 74

later:

it is look like the test is completed and appium closing driver.

So what shall i do ?

try:

for (int i=0;i<10;i++) { //10x10 = 100sec
            try {
                browser.driver.findelement(by.xpath("//UIAApplication[1]/UIAWindow[2]/UIAScrollView[1]/UIAScrollView[1]/UIAWebView[1]/UIATextField[1]")).sendKeys("RET02");
                break;
            } catch (Exception e1) {
                e1.printStackTrace();
                try{Thread.sleep(10000);}catch (Exception e2){}
            }
        }
1 Like

Unexpected identifier !

something wrong with syntax :slight_smile:

mine code is Java. rewrite it to JavaScript :-0

I’m using protractor not java :wink:

i solve the crash problem of ipad simulator but i still have the same error Element could not be located by xpath !