Jim77
Jim77

Reputation: 37

Click on Hyperlink for TD Object

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

Answers (1)

QHarr
QHarr

Reputation: 84465

You can try using the link id

ie.document.querySelector("#assessment_Reinstate").click

Upvotes: 2

Related Questions