I have used this code but I want to remove those links where it appears the string 'vs' three times in the link, it only has to appear one time:
elems = driver.find_elements_by_xpath("//a[contains(@href, '/president/us/general_election')][not(@href = following::a/@href)]")
for elem in elems:
print(elem.get_attribute("href"))
Update:
I have realised that some of my code is not working as I expected, I used the code : [not(@href = following::a/@href)] to remove repeated href but there is still one href that is repeated. Any help is welcome!
