I am getting stuck at executing a loop. My scenario is: I am tapping on bookmark present over the screen.

I am using below code for that ,

  List listAllSessionsNames=driver.findElements(By.xpath("//UIAApplication[1]/UIAWindow[2]/UIATableView[1]/UIATableCell[*]//descendant::UIAButton"));

  for(MobileElement eachSessionName:listAllSessionsNames)  {

         // initIPHONE.swipeDown();




    catch(WebDriverException e){


The problem is that the button is getting tapped until buttons are visible on screen but getting webdriverexception after tapping on the same button. The whole size of the table cell over the screen is 10 but this code can work for 5. Please help.

  • 1
    Q1- What exception are you getting. Q-2 :Clear the last line (regarding the 10, 5). That is confusing. Jan 5, 2016 at 11:48
  • i am getting WebDriverException .but this issue is resolved to some extent by re assigning the list after swipe . Currently after first swipe ,buttons are tapped multiple times that is weird . Jan 5, 2016 at 12:20
  • Then update you question with the latest information. That would be good Jan 5, 2016 at 12:48
  • What is returns when you print listAllSessionsNames.size() ? Jan 5, 2016 at 13:46
  • It was returned me exact no of values and that was 10. Jan 5, 2016 at 14:05


Your Answer

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

Browse other questions tagged or ask your own question.