Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99418

Python/Selenium - Can't get HREF value of a tag

$
0
0

So I have this HTML element:

<h2 class="post-title">

    <a href="http://google.com" rel="bookmark">This a link to Google!</a>

</h2>

I am using driver.find_elements_by_class_name('post-title') to find this piece of HTML.

But how can I extract only the value of the "href" tag?

I've tried:

driver.get_attribute('href')

returns 'none'

Thanks


Viewing all articles
Browse latest Browse all 99418

Trending Articles