Why not just search for the 2 links specifically, rather than looping through all the links in the page?