tags:

views:

94

answers:

3

I am designing a winforms based testing app (which is based upon WatiN). I specify a page to test and the value to insert into a textbox, and then click the corresponding button.

Is it possible to add a query string to the request I make (when clicking button) and then get the URL of the next page? Based on this, I need to screen scrape it.

A: 

What exactly do you mean by "next page" ? Does the form when submitted redirect to another page? If so, you will receive a HTTP 302/303 status code with the URL of the next page.

AmitK
What I basically mean is when clicking a button and the new page the button points to loads, how can I get the url of that page through WatiN?
dotnetdev
+1  A: 

Not sure about Watin syntax, but in Watir (Ruby version) you can get URL of the page displayed in browser with

browser.url

Or do you need to get URL of the next page before you open it?

Željko Filipin
+1  A: 

Based on your comment to AmitK, Željko's answer is right. In WatiN (and C#), the syntax is:

Console.WriteLine("The current page is:" + ie.Url.ToString());

(just in case: 'ie' is the browser reference, use whatever object you use to enter text and click buttons)

PhillFox