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!!
pandkyonAsked:
Who is Participating?
 
Paul MacDonaldDirector, Information SystemsCommented:
When you get to the point in code where you need to "click the link" why not just
Response.Redirect("Ranks.aspx?View=DocumentVolumes&amp;transactiontype=837j Inbound")
0
 
pandkyonAuthor Commented:
paulmacd:

when I do that, I'm getting an error under the response.redirect... "Name "Response" is not declared.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
Make sure you have "Inherits System.Web.UI.Page" (no quotes) just inside your page class.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
pandkyonAuthor Commented:
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"      
0
 
Paul MacDonaldDirector, Information SystemsCommented:
This is a web page, right?  Not a win form?
0
 
pandkyonAuthor Commented:
it is a win form.
0
 
Paul MacDonaldDirector, Information SystemsCommented:
Ah, then ignore me.  Sorry!
0
 
arunragCommented:
"Response" object is part of System.web.http class. Since you are using a win form class, you will not be able to use the Response method. I have had the same issue. So i had to switch back doing the redirect process from the ASPX page rather than from the class.
0
 
pandkyonAuthor Commented:
ahh. that explains it.  So how would I in essence trigger the href?
0
 
moorhouselondonCommented:
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.
0
 
pandkyonAuthor Commented:
switch from win form and the redirect code worked.

Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.