Module13-exercise4 | Selenium Forum
M
Posted on 29/08/2016
Able to check value from check listbox without using xpath. so that even in future if we update "String", it will work without modifying code.
1) can you please check whether this is correct logic or not?
2) This is working fine only to one check box. If user wants to select more than one check box, how to deal with it? can you please provide your input?

M
Replied on 29/08/2016

code is fine.
[quote:1apbshpz]If user wants to select more than one check box, how to deal with it? [/quote:1apbshpz]
i don't have the code but
1.)you have to use an array to store the strings you want to check.
2.) then put another for loop outside like this

[color=#FF0000:1apbshpz]for(int i=0;i<array.size;i++){[/color:1apbshpz]

for(Webelement a: val){

if(equals ignore case){
click;
break;
}
}
}


M
Replied on 30/08/2016

Thanks. Using arraylist, able to select multiple check boxes.

Responsive image