If your problem is with identifying sifferent urls because they are same. You can try including a idx to iterate theough all the urla and click on each that way you will be able to use click as well and it would be reliable. If you dont know how many urls would be there then just add try catch around it and when caught exit your loop
Cheers