I am using appium 1.4.8 on mac and I'm automating native app using selenium. I am stuck at a situation where I need to tap each element in a list. I wrote below code:

List allKeywords=driver.findElements(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIATableView[]/"));
System.out.println("TEST TAPS ON THE EVENT SENT BY EXCEL SUCCESSFULLY "+allKeywords.size());

for(int j=0; j<=allKeywords.size(); j++){

    try{
        Thread.sleep(4000);
        allKeywords.get(j).click();

        System.out.println("TEST TAPS ON THE EACH KEYWORDS ");      
        }

    catch(WebDriverException e ){
        e.printStackTrace();
        captureScreenshot(driver, "tagsTappingImg");    

        }

}   

But I am getting error message :

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: 772 milliseconds .

This error is shown when control tries to tap on next to first element.

  • try this for(Webelement ele:allKeywords){ ele.click(); } – sameer joshi Mar 21 '16 at 5:12
  • 1
    From your comment on the answer it looks like your issue was resolved. Could you either accept the existing answer or add your own with what fixed your error? Otherwise this still shows up as an unanswered question. – c32hedge Aug 15 '17 at 15:12

You need to cast the list element in Web Element. As below.

List<WebElement>allKeywords=driver.findElements(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIATableView[]/"));
  • This is the code : List<WebElement> allKeywords=driver.findElements(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIATableView[]/")); I did in same way but still i am getting this error. – Ranjan Gupta Sep 22 '15 at 8:57
  • Okay. Can you get the detailed exception? Is that exception not getting catch? May be there is some other cause. What I observed from first line of code, that the casting is missing. – MKay Sep 22 '15 at 9:14
  • issue is resolved .As the list elements had to be tapped only once as it was set up by admin .in order to make it understandable i handled exception . – Ranjan Gupta Sep 22 '15 at 13:10

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.