Link to home
Start Free TrialLog in
Avatar of pandkyon
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_contentPlaceHolder_dgDocumentsByTransaction__ctl3_Hyperlink1" href="Ranks.aspx?View=DocumentVolumes&amp;transactiontype=837j Inbound">837j Rank By Partner</a>

For the other click buttons, this code is working:

For Each element As HtmlElement In m_document.getElementsByTagName("input")
            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!!
ASKER CERTIFIED SOLUTION
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of pandkyon
pandkyon

ASKER

paulmacd:

when I do that, I'm getting an error under the response.redirect... "Name "Response" is not declared.
Make sure you have "Inherits System.Web.UI.Page" (no quotes) just inside your page class.
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?
it is a win form.
Ah, then ignore me.  Sorry!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.
switch from win form and the redirect code worked.

Thanks