|
-
Oct 16th, 2007, 09:09 AM
#1
Thread Starter
Hyperactive Member
Find and click a hyperlink in a browser?
System.Diagnostics.Process.Start("iexplore http://www.site.com")
Using a winform how would you find and click a hyperlink on a page?
-
Oct 16th, 2007, 09:12 AM
#2
Re: Find and click a hyperlink in a browser?
unless you have some way to hook into the external IE process to read the DOM, find the link, and then click on it, I don't know how you would do that.
If you were to host the browser control in WinForms, it can easily be done, because the browser control can expose the DOM to your app, so you can manipulate it. See my signature for an example project on how to do that.
-
Oct 16th, 2007, 09:19 AM
#3
Re: Find and click a hyperlink in a browser?
You could just bypass that by requesting the contents of the page using HttpWebRequest, finding the hyperlink you want and calling iexplore to THAT URL!
-
Oct 16th, 2007, 11:33 AM
#4
Thread Starter
Hyperactive Member
Re: Find and click a hyperlink in a browser?
Using this code i was able to get all the HTML from the site.
Code:
Dim pr As New WebProxy
pr.Credentials = CredentialCache.DefaultCredentials
Dim wRequest As Net.WebRequest
Dim wResponse As Net.WebResponse
wRequest = Net.WebRequest.Create(URL)
wRequest.Proxy = pr
wResponse = wRequest.GetResponse
Return New System.IO.StreamReader( _
wResponse.GetResponseStream, _
System.Text.Encoding.GetEncoding("utf-8")).ReadToEnd
Code:
<a href="http://www.AAA.com/search/redirect.php?f=http%3A%2F%2Fpagead2.xxxxxxxxx.com%2Fpagead%2Ficlk%3Fsa%3Dl%26ai%3DBmFISjt8UR_z9FpDYoQPl7cSGCqWd4DHtxZvBAsCNtwHgxQgQAhgCIOqdzAMoCjgAUMqOqyVgydbljOSk8BOgAZ_f4f4DsgELY294d2lmaS5jb23IAQHaARNodHRwOi8vY294d2lmaS5jb20vgAIBqAMB6AMN6AP-AugD2gLoA7cC9QNAAQAA%26num%3D2%26adurl%3Dhttp%3A%2F%2Fwww.xxxx.com%26client%3Dca-dp-sedo-04_xml&l=ZjI1MDNkYzg2MGFhOGRlZTQ5NTU5OWI0YWZmYzMzNjEJMC4wNTk5CTQJMTMJMQkwCQkxMAkyCTAJYzU5YTA2NGQwMDIwNTA1MzI0NjUwNzkwNTAyMTU0NjAJd3d3LldpRmkuY29tCTMwMjgzNDczCWMJMTg3ODA4MgkwCTQJZnJlZSB3aWZpCTIzCTEJNQk1OQkwCTAuMDkwMDAwCU4JMAlhMDkyOTVkZjQ3NTA0YjFjYzhjNDNhZGQzODY0NzM0MwkwCTAJMA=="
class="aLink"
target="_blank"
onmouseout="window.status=''"
onmouseover="window.status=''; return true;">www.ABC.com</a>
Any clue how i would gather the HTML from above and navigate to the URL in the string?
-
Oct 16th, 2007, 11:46 AM
#5
Lively Member
Re: Find and click a hyperlink in a browser?
 Originally Posted by kleinma
See my signature for an example project on how to do that.
I looked at your project to manipulate the axWebBrowser. Great functions by the way, i think ill see what i can do to use them. Here is a list of functions that I found in there:
Code:
GetTextboxText()
SetTextareaText(txtData.Text)
GetTextareaText()
ClickNormalButton()
ClickSubmitButton()
GetLinks()
ChangeDIVColor()
ShowPageSource()
ExecuteJavascript()
PrintPage()
GetImageInfo()
GetComboValue()
ClickCheckBox()
I don't see a ClickLink function/Procedure just GetLinks. Closest I saw, and this might be workable, but please enlighten me is clickSubmitButton or ClickNormalButton.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|