I am new to excel vba programing. I have been trying to click on a hyperlink on a web page using excel vba from almost 3 days now. Please help me out. Since I am new to this I might have made a lot of blunders. Pardon me for that.
The scenario is : A particular web page has a table with first column as an icon, second column is a hyperlink and a few more columns with some description about the hyperlink.
Now, I want to click on the hyperlink in the first row (second column). When we hover over the icon present in the same row(in first column) the same hyperlink is displayed.
This webpage is dynamic, hence the table keeps changing. Actually the table is a result of a search criteria entered.
I have written a lot of codes from three days. This is the latest one thats not working:
'Get element id for the row
With elementid = ieApp.document.all.Item("abcrow1")
'checking for details with tagname as "a"
Set tagname = ieApp.document.getElementByTagName("a")
For Each tag In tagname
'Get value of the href
hrefvalue = tag.href.value
If Not IsNull(hrefvalue) Then
If hrefvalue <> "javascript:void(0);" Then 'this href is usedto describe the icon
hrefvalue = ieApp.document.href.value
hrefvalue = "https://www.secur.com" & hrefvalue
ieApp.Navigate hrefvalue
Exit For
End If
End IF
Next tag
End With
The HTML script is as follows:
<tr id = "abcrow1" class="e1">
<td class = "icon"></td>
<td><ul class="xyz" id="link">
<li><a href = "javascript:void(0);"><img src="/nnn.gif" border = 0 alt = "info" </a>
<ul>
<li><a onclick ="return cursorWait(this);" href = "/xyz/lmo">DetailOfRow1</a></li></ul></td>
<td style = "text-align:left"><aonclick="return cursorWait(this);" href = "/xyz/lmo">DetailOfRow1</a></td></tr>
Please help me out. Thank you.