Quick Links
<span class="buttonContainer"><input type="image" class="helpButton" src="/images/buttons/btn_help.gif" alt="View help." title="View help."><input type="image" class="minimizeButton" src="/businesscare/images/dashboard/btn_minus_white.gif" alt="Show less." aria-controls="tile-contents" aria-expanded="true" aria-live="polite"></span></dt>
<dd>
<strong>Help:</strong> Quickly access the tools you need to view your
Name lists.
</dd>
</dl>
<div class="tile-contents">
<div><strong>Note:</strong> links open a new window.</div>
<div class="loading" style="display: none;">
<div>
<p></p>
</div>
</div>
<hr>
<div class="configuration" style="display: none">
<p>Choose and drag any transaction type to reorder your
shortcuts. Your top five shortcuts will be displayed by default in
the shaded area.</p>
<hr>
<ul class="dragable">
</ul>
</div>
<h4>Links</h4>
<ul class="contents">
<li><a href="Home" title="View home" onclick="openlink(this,this.title);return false;">View home</a></li>
</ul>
<hr>
<h4 id="Numbers">Numbers</h4>
<ul class="contents">
<li><a href="Link1" onclick="openlink(this,this.title);return false;">View Link1</a></li>
<li><a href="Link2" title="View Link2" onclick="openlink(this,this.title);return false;">View Link2</a></li>
<li><a href="Link3" title="View Link4" onclick="openlink(this,this.title);return false;">View Link3</a></li>
</ul>
<hr>
<h4 id="Photos">Photos</h4>
<ul class="contents">
<li><a href="Link4" title="Select Link4" onclick="openlink(this,this.title);return false;">Select Link4</a></li>
</ul>
<hr>
<h4 id="downloads">Downloads</h4>
<ul class="contents">
<li><a href="Link5" title="Download Link5" onclick="openlink(this,this.title);return false;">Download </a></li>
</ul>
<hr>
<h4 id="qlinkusers">Users</h4>
<ul class="contents">
<li><a href=Link6" title="View Link6" onclick="openlink(this,this.title);return false;">View Users</a></li>
</ul>
</div>
</li>
I need to fetch all the hrefs on the page and click them. I tried to fetch the links using the following code but the code returns empty list.
hRefs = []
parent = browser.find_element_by_class_name("contents")
links = parent.find_elements_by_tag_name("a")
for link in links:
hRefs.append(link)
print hRefs
This is what I get when I run the code an empty list.
[<selenium.webdriver.remote.webelement.WebElement (session="386157b412d34905ae7344a206c156da", element="0.8337721961119238-2")>]