Click here to Skip to main content
15,881,380 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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

1 solution

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

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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900