The following is a bunch of links ONLY one of them has a substring \"long\" as a value for the attribute href
You can do this:
//first get all the elements
List linkList=driver.findElements(By.tagName("a"));
//now traverse over the list and check
for(int i=0 ; i
in this what we r doing is first we are finding all the tags and storing them in a list.After that we are iterating the list one by one to find tag whose href attribute contains long string. And then we click on that particular tag and comes out of the loop.