pandkyon
asked on
How to programmatically click a href
I am automating some web routines in vb.net. There is a hyperlink I need to click on programmatically; how would I do so? Here is the href in the source code:
<a id="_ctl0_contentPlaceHold er_dgDocum entsByTran saction__c tl3_Hyperl ink1" href="Ranks.aspx?View=Docu mentVolume s&tran sactiontyp e=837j Inbound">837j Rank By Partner</a>
For the other click buttons, this code is working:
For Each element As HtmlElement In m_document.getElementsByTa gName("inp ut")
counter = counter + 1
If element.Name = "signInControl:loginButton " Then
Debug.Print("Sign In button element found")
login = element.DomElement
login.click()
counter = 0
Exit For
End If
Next element
How would I "click" the href link.
Thanks!!
<a id="_ctl0_contentPlaceHold
For the other click buttons, this code is working:
For Each element As HtmlElement In m_document.getElementsByTa
counter = counter + 1
If element.Name = "signInControl:loginButton
Debug.Print("Sign In button element found")
login = element.DomElement
login.click()
counter = 0
Exit For
End If
Next element
How would I "click" the href link.
Thanks!!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Make sure you have "Inherits System.Web.UI.Page" (no quotes) just inside your page class.
ASKER
I'm using vb.net 2008 and when I plug in "Inherits System.Web.UI.Page" inside the page class, I get the following: 'System.Web.UI.Page' is not defined"
This is a web page, right? Not a win form?
ASKER
it is a win form.
Ah, then ignore me. Sorry!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ahh. that explains it. So how would I in essence trigger the href?
I'm not a vb coder so please scuse my igorance. If it's a winform application then can't you define the "href" as a label: underline it and colour it blue if you wish, then use the labels's onclick event to do whatever you want.
ASKER
switch from win form and the redirect code worked.
Thanks
Thanks
ASKER
when I do that, I'm getting an error under the response.redirect... "Name "Response" is not declared.