I have 3 screens where 1st screen has N number of buttons in list view format similarly in 2nd screen and third screen has next button which I need to press N times and from third I need to back on first screen then second screen then third screen.
Screenshot would help to understand you scenario. Please attach if you can.
this looks dynamic like
class vi has 2 subjects
class vii has 2+ subjects
then
each subject have dynamic number of multiple sections with questions
List<WebElements> screen1 = driver.findElements(By.className("buttons in list view"));
for (int i=0;i less then screen1.size();i++){
screen1.get(i).click(); // this takes us to screen 2 for first class like class vi
List<WebElements> screen2 = driver.findElements(By.className("get all subject of class v1"));
for (int j=0;j less then screen2.size();j++){
screen2.get(j).click();
List<WebElements> screen3 = driver.findElements(By.className("get all question of class v1 subject 1"));
for (int k=0;k less then screen2.size();k++){
screen3.get(k).click();
// now we reached to questions u can perform verification here
} // end of screen 3 for loop
} // end of screen 2 for loop
}// end of screen 1 for loop
Challenge here is we need a single locator that build list of all WebElements on a page we need to click.
@amitjaincoer191,
Its working as expected but there is one problem, It is picking random list item from every screen while it should be sequence.
Please help me out to pick the item from list one by one not randomly.
1 Like