b.hill
03-14-2013, 07:18 PM
I am trying to click on several links in a web page. They are all within classes named "addressbox". There are multiple classes with the name "addressbox". The names of the links are different each time so I cannot name them in the code.
I cannot get my code to click on the link in each class, but the logic is this:
Sub GetData
'code to go to website (this part is working)
For each class that equals "addressbox" in the html document
Click on the second href link
'Extract data (this part is working)
ie.GoBack (this part should work but it's untested)
Next
End Sub
Here is part of the source code with one of the "addressbox" classes. In this case, I would like to follow the href="/669738/detail" link but I would not always know the name of the href:
<div class="addressbox" id="adbox0">
<div class="adline">
<table>
<tr>
<td valign="top">
<input type="checkbox" name="homecheckbox" value="11491|GDAR"/>
</td>
<td valign="top">
<div class="newIcon fLeft tooltipImage" id="newIcon0" title="New">NEW</div>
<script type="text/javascript">
createTooltip('newIcon0', '<p>Within 3 <a href="/check?src=searchResultsNewIcon">Here</a></p>');
</script>
<a href="/669738/detail">Click here</a>
</td>
</tr>
</table>
</div>
I cannot get my code to click on the link in each class, but the logic is this:
Sub GetData
'code to go to website (this part is working)
For each class that equals "addressbox" in the html document
Click on the second href link
'Extract data (this part is working)
ie.GoBack (this part should work but it's untested)
Next
End Sub
Here is part of the source code with one of the "addressbox" classes. In this case, I would like to follow the href="/669738/detail" link but I would not always know the name of the href:
<div class="addressbox" id="adbox0">
<div class="adline">
<table>
<tr>
<td valign="top">
<input type="checkbox" name="homecheckbox" value="11491|GDAR"/>
</td>
<td valign="top">
<div class="newIcon fLeft tooltipImage" id="newIcon0" title="New">NEW</div>
<script type="text/javascript">
createTooltip('newIcon0', '<p>Within 3 <a href="/check?src=searchResultsNewIcon">Here</a></p>');
</script>
<a href="/669738/detail">Click here</a>
</td>
</tr>
</table>
</div>