elems = driver.find_elements_by_xpath("//a[@href]") for elem in elems: print(elem.get_attribute("href"))
Here is what the above code is Doing:
1. It’s creating a list of all the elements on the page that have an href attribute.
2. It’s iterating over that list.
3. For each element in the list, it’s printing the value of the href attribute.