Programmatically navigating/"running" a webpage

  • Thread starter Thread starter John Spiegel
  • Start date Start date
J

John Spiegel

Hi all,

I think this is a longshot, but is there a technique for programmatically
run a webpage?

Let's say one of our vendors has a page that we go to daily to pick up some
files. Each time, the user clicks a link, that brings up a file dialog
prompting for a local name to download to and OK's. This process is
repeated for a number of files.

I'm wondering if something like this is possible: You could have a form
hosting an MS WebControl, navigated to a page where you know the layout.
Then perhaps there might be a method exposed that would allow you to read
the text of the HTML programmatically. You could parse that to decipher
which href you need, then post the page as if that link had been clicked.

The whole idea feels very kludgy, even if it would work, but it would suit a
few purposes.

TIA,

John
 
The typically way to do this is with regular expressions.
What you would do is the following:

'Create a connection to the web page
Dim wRequest As Net.HttpWebRequest =
Net.HttpWebRequest.Create("urlhere")

'Get a reference to the response object
Dim wResponse As System.Net.HttpWebResponse =
wRequest .GetResponse

'Get the web page
Dim sr As New IO.StreamReader(obj.GetResponseStream)
Dim strPage As String = sr.ReadToEnd

Then, parse the strPage variable using regular
expressions to find the correct a href tag.

Hope this helps.

Jeff Levinson

Author of "Building Client/Server Applications with
VB.NET: An Example Driven Approach"
 
John.

Try Windows Scripting Host - I have seen complete web site test harnesses
built using this language

- peteZ
 
Back
Top