I would like to get href
value from <a>
element in Splinter.
Is there any api method for that?
If you are selecting elements using the find_by_* methods, instances returned by these are ElementList
s. After you select the element you are interested in (most probably an ElementAPI
instance), access the property like a dictionary:
the_element['href']
#simplest possible working example demonstrating this in action
import splinter
b = splinter.Browser()
b.visit("http://www.google.com")
elems = b.find_by_tag("a")
for e in elems:
print(e["href"])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With