Click here to Skip to main content
12,945,697 members (52,399 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,
I am trying to post data to a web page control but may be missing some important call.

Exact requirement:
1) Open an url
2) sign in to the application
3) Click a link to desired page or directly use the next page url to get the HTML webresponse.

Till here everything is fine

4) Now i need to put some data in 2 available textbox items available in the web response and click a button to let the page data posted to site and database and get the redirected URL

I am stuck in the 4th point.

Can anyone help
Thanks in advance

note its a C# console application i m using to create this test suit.
Posted 13-Dec-12 1:55am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

I had a similar issue with a screenscraper program, and solved it with the following code:
HtmlElement element = Document.All["username"];
element.SetAttribute("value", myLogon);
element = Document.All["password"];
element.SetAttribute("value", myPassword);
element = Document.All["commit"];

The textboxes are named username and password in the DOM of the web page, and the action button is labelled commit. You just need to look into the HTML source to find the names of the elements that you wish to alter or otherwise manipulate.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 4,899
CHill60 3,170
Maciej Los 2,443
Jochen Arndt 1,910
ppolymorphe 1,775

Advertise | Privacy | Mobile
Web01 | 2.8.170518.1 | Last Updated 13 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100