I am getting this error while testing appium for ios :
> Exception in thread "main" org.openqa.selenium.WebDriverException: An > error occurred while executing user supplied JavaScript. (WARNING: The > server did not provide any stacktrace information) Command duration or > timeout: 5.15 seconds Build info: version: '2.52.0', revision: > '4c2593c', time: '2016-02-11 19:03:33' System info: host: > 'users-iMac.local', ip: '192.168.1.16', os.name: 'Mac OS X', os.arch: > 'x86_64', os.version: '10.10.5', java.version: '1.7.0_80' Session ID: > cdcaf9fa-3530-4b09-8bca-c30c42d6c29e Driver info: > io.appium.java_client.ios.IOSDriver Capabilities > [{platformVersion=9.2, platform=MAC, databaseEnabled=false, > javascriptEnabled=true, platformName=iOS, deviceName=iPad 2, > browserName=iOS, webStorageEnabled=false, > bundleId=com.InovaSquad.Artinove, networkConnectionEnabled=false, > desired={platformVersion=9.2, deviceName=iPad 2, platformName=iOS, > bundleId=com.InovaSquad.Artinove}, locationContextEnabled=false, > warnings={}, takesScreenshot=true}] at > sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at > org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:206) > at > org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:158) > at > org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:678) > at > io.appium.java_client.DefaultGenericMobileDriver.execute(DefaultGenericMobileDriver.java:42) > at io.appium.java_client.AppiumDriver.execute(AppiumDriver.java:1) at > io.appium.java_client.ios.IOSDriver.execute(IOSDriver.java:1) at > org.openqa.selenium.remote.RemoteWebElement.execute(RemoteWebElement.java:327) > at > io.appium.java_client.DefaultGenericMobileElement.execute(DefaultGenericMobileElement.java:44) > at io.appium.java_client.MobileElement.execute(MobileElement.java:1) > at io.appium.java_client.ios.IOSElement.execute(IOSElement.java:1) at > org.openqa.selenium.remote.RemoteWebElement.sendKeys(RemoteWebElement.java:122) > at test1.FirstTest.main(FirstTest.java:49)
FirstTest.java
package test1;
import java.net.MalformedURLException;
import java.net.URL;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import io.appium.java_client.AppiumDriver;
import io.appium.java_client.ios.IOSDriver;
import io.appium.java_client.ios.IOSElement;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
/*
@author:Hajar
11/03/2016
*/
public class FirstTest {
public static AppiumDriver dr;
public static void main(String[] args)
throws MalformedURLException, InterruptedException{
DesiredCapabilities capabilities = new DesiredCapabilities();
// Platform de l'emulateur
capabilities.setCapability("platformName","iOS");
// La version de l'emulateur
capabilities.setCapability("platformVersion", "9.2");
// le nom de l'emulateur
capabilities.setCapability("deviceName","iPad 2");
capabilities.setCapability("bundleId","com.InovaSquad.Artinove");
dr=new IOSDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities);
dr.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/UIAWebView[1]/UIALink[2]/UIAStaticText[1]")).click();
dr.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[2]/UIAWebView[1]/UIATextField[1]")).sendKeys("ggg");
}
}
Server logs :
info : [debug] Sending command to instruments: au.getElementByIndexPath('/0/0/1/0/1') info: [IOS_SYSLOG_ROW ] Mar 18 15:39:46 users-iMac mstreamd[70568]: (Note ) PS: Media stream daemon stopping. info: [IOS_SYSLOG_ROW ] Mar 18 15:39:46 users-iMac mstreamd[70568]: (Note ) AS: : Shared Streams daemon has shut down. info: [IOS_SYSLOG_ROW ] Mar 18 15:39:46 users-iMac mstreamd[70568]: (Warn ) mstreamd: mstreamd shutting down.
info: [debug] [INST] 2016-03-18 15:39:46 +0000 Debug: Got new command 7 from instruments: au.getElementByIndexPath('/0/0/1/0/1') info: [debug] [INST] 2016-03-18 15:39:46 +0000 Debug: evaluating au.getElementByIndexPath('/0/0/1/0/1')
info: [debug] Socket data received (38 bytes)
info: [debug] Socket data being routed. info: [debug] Got result from instruments: {"status":0,"value":{"ELEMENT":"1"}} info: [debug] Responding to client with success: {"status":0,"value":{"ELEMENT":"1"},"sessionId":"d860df3d-b4be-46a5-8ee4-de67f7d04e55"} info: <-- POST /wd/hub/session/d860df3d-b4be-46a5-8ee4-de67f7d04e55/element 200 2387.424 ms - 87 {"status":0,"value":{"ELEMENT":"1"},"sessionId":"d860df3d-b4be-46a5-8ee4-de67f7d04e55"}
info: --> POST /wd/hub/session/d860df3d-b4be-46a5-8ee4-de67f7d04e55/element/1/value {"id":"1","value":["ggg"]} info: [debug] Pushing command to appium work queue: "au.getElement('1').setValueByType('ggg')" info: [debug] Sending command to instruments: au.getElement('1').setValueByType('ggg') info: [debug] [INST] 2016-03-18 15:39:46 +0000 Debug: evaluation finished info: [debug] [INST] 2016-03-18 15:39:46 +0000 Debug: responding with: info: [debug] [INST] 2016-03-18 15:39:46 +0000 Debug: Running system command #8: /Applications/Appium.app/Contents/Resources/node/bin/node /Applications/Appium.app/Contents/Resources/node_modules/appium/submodules/appium-uiauto/bin/command-proxy-client.js /tmp/instruments_sock 2,{"status":0,"value":{"ELEMENT":"1"}}...
info: [debug] [INST] 2016-03-18 15:39:47 +0000 Debug: Got new command 8 from instruments: au.getElement('1').setValueByType('ggg')
info: [debug] [INST] 2016-03-18 15:39:47 +0000 Debug: evaluating au.getElement('1').setValueByType('ggg') info: [debug] [INST] 2016-03-18 15:39:47 +0000 Debug: No keyboard found. Tapping to make visible. info: [debug] [INST] 2016-03-18 15:39:47 +0000 Debug: target.frontMostApp().elements()[0].elements()[1].elements()[0].elements()[1].tap()
info: [IOS_SYSLOG_ROW ] Mar 18 15:39:47 users-iMac assertiond[70583]: assertion failed: 14F27 13C75: assertiond + 13207 [792516D1-991E-36EE-8454-16F8220758D6]: 0x1 info: [debug] [INST] 2016-03-18 15:39:48 +0000 Debug: Still no keyboard found. Tapping again to make visible.
info: [debug] [INST] 2016-03-18 15:39:48 +0000 Debug: target.frontMostApp().elements()[0].elements()[1].elements()[0].elements()[1].tap()
info: [IOS_SYSLOG_ROW ] Mar 18 15:39:50 --- last message repeated 3 times --- info: [IOS_SYSLOG_ROW ] Mar 18 15:39:50 users-iMac Artinove[70619]: mousedown stop event
info: [IOS_SYSLOG_ROW ] Mar 18 15:39:50 users-iMac assertiond[70583]: assertion failed: 14F27 13C75: assertiond + 13207 [792516D1-991E-36EE-8454-16F8220758D6]: 0x1
info: [debug] [INST] 2016-03-18 15:39:50 +0000 Debug: target.frontMostApp().keyboard().typeString("g")
info: [debug] [INST] 2016-03-18 15:39:51 +0000 Debug: target.frontMostApp().keyboard() failed to tap 'g'
info: [debug] [INST] 2016-03-18 15:39:51 +0000 Debug: Error typing 'g': VerboseError: target.frontMostApp().keyboard() failed to tap 'g'
info: [IOS_SYSLOG_ROW ] Mar 18 15:39:51 --- last message repeated 1 time --- info: [IOS_SYSLOG_ROW ] Mar 18 15:39:51 users-iMac kbd[70636]: table drop: 101
info: [debug] [INST] 2016-03-18 15:39:51 +0000 Debug: Retrying... info: [debug] [INST] 2016-03-18 15:39:51 +0000 Debug: target.frontMostApp().keyboard().typeString("g")
info: [debug] [INST] 2016-03-18 15:39:52 +0000 Debug: target.frontMostApp().keyboard() failed to tap 'g'
info: [debug] Socket data received (76 bytes)
Any assistance would be greatly appreciated!