Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python Selenium: How can I print the link?

How can I print the value of the href attribute?

<a href="aaaaa.pdf"></a>

How can I print the link aaaaa.pdf with python selenium?

HTML:

<div class="xxxx">
    <a href="aaaaa.pdf"></a>
</div>
like image 273
ADAM Avatar asked Jun 21 '26 11:06

ADAM


1 Answers

You can do like this:

print(driver.find_element_by_css_selector(".xxxx a").get_attribute('href'))
like image 113
Ari Avatar answered Jun 23 '26 23:06

Ari



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!