In the below code contains_All hashmap is putting the key and value for each iteration. After for loop I am clicking on next button again putting the name and state in hashmap so my hashmap should contain all the values for every page. But when i am printing the hashmap I am getting 4 lists
- The key and value of 1 page.
- The key value of 2 pages along with 1 page 3.The key value of 3 page along with 1 and 2
- The key value of 4 pages along with previous all
NOw when I am iterating the map I am getting too many values as it is printing 1, 2,3 and4 But I want only the 4 which contains all
public static validate()
{
get value();
while (utils.isElementDisplayed(next)) {
utils.waitForElement(next, 20);
utils.click(next);
getValue();
}
public getValue{
for (int i = 0; i < allRows.size(); i++) {
names = ds_name.get(i).getText();
seName = ds_server.get(i).getText();
state = ds_state.get(i).getText();
String names_seName = name_ds.concat("_" + serverName_ds);
containsAll.put(names_seName, state);
}
System.out.println(containsAll);
Iterator it = containsAll.entrySet().iterator();
while (it.hasNext()) {
Map.Entry ent = (Map.Entry) it.next();
System.out.println("-----------------------------------------------------------");
System.out.println(ent.getKey() + "= " + ent.getValue());
Reporter.log("-----------------------------------------------------------");
Reporter.log(ent.getKey() + "= " + ent.getValue());
}
}