Lets say I have html code with three links
<a href="hey123"> Whatever </a>
<a href="hey321"> Whatever </a>
<a href="hi123"> Whatever </a>
and I want to use selenium to find all elements which have a href tag which includes the string "hey" (in this case the first two links). How would I write python Selenium code which accomplishes this?
>Solution :
This works:
all_href = driver.find_elements(By.XPATH, "//*[contains(@href, 'hey')]")
print(len(all_href)