Well, you have to simply loop through the list:
elems = driver.find_elements_by_xpath("//a[@href]")
for elem in elems:
print(elem.get_attribute("href"))
find_elements_by_*
returns a list of elements (note the spelling of ‘elements’). Loop through the list, take each element and fetch the required attribute value you want from it (in this case href
).
More Related Contents:
- how to scrape web page that is not written directly using HTML, but is auto-generated using JavaScript? [closed]
- selenium with scrapy for dynamic page
- How can I download a file on a click event using selenium?
- Python: find_element_by_css_selector
- ‘list’ object has no attribute ‘get_attribute’ while iterating through WebElements
- How to click a link by text with No Text in Python
- Selenium-Debugging: Element is not clickable at point (X,Y)
- Python selenium error when trying to launch firefox
- ChromeDriver Error: ‘chromedriver’ executable needs to be in PATH [duplicate]
- selenium in python : NoSuchElementException: Message: no such element: Unable to locate element
- Selenium: WebDriverException:Chrome failed to start: crashed as google-chrome is no longer running so ChromeDriver is assuming that Chrome has crashed
- unknown error: session deleted because of page crash from unknown error: cannot determine loading status from tab crashed with ChromeDriver Selenium
- How to get attribute of element from Selenium?
- ‘Webdrivers’ executable may have wrong permissions. Please see https://sites.google.com/a/chromium.org/chromedriver/home
- find_element_by_* commands are deprecated in selenium
- Scrape website with dynamic mouseover event
- Get value of an input box using Selenium (Python)
- How to change the User Agent using Selenium and Python
- SessionNotCreatedException: This version of ChromeDriver only supports Chrome version 84 using ChromeDriver and Chrome through Selenium and Python
- Python and how to get text from Selenium element WebElement object?
- How to test non-standard drop down lists through a crawler using Selenium and Python
- How can I get text of an element in Selenium WebDriver, without including child element text?
- Python selenium: wait until element is clickable – not working
- How locate the pseudo-element ::before using Selenium Python
- Scraping dynamic data selenium – Unable to locate element
- How can we use Selenium Webdriver in colab.research.google.com?
- Selenium – visibility_of_element_located: __init__() takes exactly 2 arguments (3 given)
- How to locate the First name field within shadow-root (open) within the website https://www.virustotal.com using Selenium and Python
- Browser performance tests through selenium
- How to click on Load More button within Google Trends and print all the titles through Selenium and Python