Reputation: 37
I want to click on a hyperlink on a webpage using VBA that I have found using the below method:
Set trs = ie.document.getElementsByTagName("tr")
For Each trObj In trs
Set tds = trObj.getElementsByTagName("td")
For Each tdObj In tds
If tdObj.className = "btn_container" And tdObj.innerText = "Reinstate Award" Then
tdObj.Click
End If
Next
Next
I can't get the tdObj.Click
bit to click the hyperlink.
The html is below:
<td class="btn_container">
<input name="_linkSubmit" type="hidden"><a name="assessment_Reinstate" class="button_link" id="assessment_Reinstate" onclick="javascript:return disableLinks(this.href);" href='javascript:submitLink(document.Form0,"assessment_Reinstate");' type="button" renderer="uk.co.slc.tapestry.link.PortalLinkRenderer@1a79ffb">Reinstate Award</a>
</td>
Any help would be greatly appreciated.
Thanks
Jim
Upvotes: 2
Views: 44
Reputation: 84465
You can try using the link id
ie.document.querySelector("#assessment_Reinstate").click
Upvotes: 2