troubleshooting Question

selenium python question

Avatar of Hiro 714
Hiro 714 asked on
1 Comment1 Solution18 ViewsLast Modified:
I want to list URLs in elems. Please advise.
elems = driver.find_elements_by_xpath("//a[contains(@href,'')]")
#for elem in elems:
url = elems.get_attribute("href")
I'm getting this error.
AttributeError                            Traceback (most recent call last)
<ipython-input-291-f30319c0a4c2> in <module>
      2 #for elem in elems:
----> 4 url = elems.get_attribute("href")
      5 print(url)

AttributeError: 'list' object has no attribute 'get_attribute'
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros