Getting a unknown server-side error while re- using a selenium code

org.openqa.selenium.WebDriverException: An unknown server-side error occurred while processing the command. (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 1.69 seconds
Build info: version: ‘2.48.2’, revision: ‘41bccdd’, time: ‘2015-10-09 19:55:52’
System info: host: ‘XXXX-MacBook-Pro.local’, ip: ‘192.168.1.8’, os.name: ‘Mac OS X’, os.arch: ‘x86_64’, os.version: ‘10.11.3’, java.version: ‘1.8.0_65’
Driver info: io.appium.java_client.ios.IOSDriver
Capabilities [{networkConnectionEnabled=false, desired={}, warnings={}, webStorageEnabled=false, locationContextEnabled=false, browserName=iOS, takesScreenshot=true, javascriptEnabled=true, databaseEnabled=false, platform=MAC}]
Session ID: fda9ef32-13e0-4ee9-8817-8d98d1c37b4e
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:422)
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:647)
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:326)
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.click(RemoteWebElement.java:84)
at WishboneiOS.LoginTest.successLogin(LoginTest.java:128)
at WishboneiOS.LoginTest.login(LoginTest.java:94)
at WishboneiOS.LoginTest.f(LoginTest.java:43)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:639)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:816)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1124)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
at org.testng.TestRunner.privateRun(TestRunner.java:774)
at org.testng.TestRunner.run(TestRunner.java:624)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:359)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:354)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:312)
at org.testng.SuiteRunner.run(SuiteRunner.java:261)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1215)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1140)
at org.testng.TestNG.run(TestNG.java:1048)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:112)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:205)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:176)

This error I am getting while I re-use a selenium code. I am not able move further.

Example: When I call a function for the first time it’s successful and but when the same function is called for second time in the same session, it fails.

Appium server errors:
Error: VerboseError: elementId 20 could not be tapped
info: [debug] Got result from instruments: {“status”:13,“value”:“elementId 20 could not be tapped”}
info: [debug] Responding to client with error: {“status”:13,“value”:{“message”:“An unknown server-side error occurred while processing the command.”,“origValue”:“elementId 20 could not be tapped”},“sessionId”:“fda9ef32-13e0-4ee9-8817-8d98d1c37b4e”}
info: <-- POST /wd/hub/session/fda9ef32-13e0-4ee9-8817-8d98d1c37b4e/element/20/click 500 1688.948 ms - 201

Can somebody help me in this…? Struggling for a few days now.

write your code around this line:

at WishboneiOS.LoginTest.successLogin(LoginTest.java:128)

Code is written in that particular block only… Still I am facing issues. @Aleksei

write your code here what you are doing

public static void successLogin() throws Exception
{
if(!driver.findElements(By.name(“OK”)).isEmpty())
{
driver.findElement(By.name(“OK”)).click();
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAScrollView[1]/UIAImage[1]")).click();
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAScrollView[1]/UIAButton[1]")).click();
}
else
{
Thread.sleep(10000);
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAScrollView[1]/UIAImage[1]")).click();
driver.findElement(By.xpath("//UIAApplication[1]/UIAWindow[1]/UIAScrollView[1]/UIAScrollView[1]/UIAButton[1]")).click();
}
}

This seems to be a problem from the appium server. Because I am finding the same issue even through the Appium inspector without running from selenium code.

In the first iteration it works fine. But when I enter the same screen the second time in the loop, I find this problem.

This is fixed. There were conflicting elements in the app.