7

I am using appium 1.4.8 on mac and I'm automating native app using selenium. I am stuck in 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 an 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 the first element.

2
  • try this for(Webelement ele:allKeywords){ ele.click(); } Mar 21, 2016 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, 2017 at 15:12

1 Answer 1

1

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

List<WebElement>allKeywords=driver.findElements(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIATableView[]/"));
4
  • 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. Sep 22, 2015 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, 2015 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 . Sep 22, 2015 at 13:10
  • @RanjanGupta could you mark the question as resolved? It's listed as "unanswered" :) Aug 23, 2019 at 21:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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