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 same button . The whole size of the table cell over the screen are 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. – demouser123 Jan 5 '16 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 . – Ranjan Gupta Jan 5 '16 at 12:20
  • Then update you question with the latest information. That would be good – demouser123 Jan 5 '16 at 12:48
  • What is returns when you print listAllSessionsNames.size() ? – Helping Hands Jan 5 '16 at 13:46
  • It was returned me exact no of values and that was 10. – Ranjan Gupta Jan 5 '16 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.