Auto fill web page using ASP.Net C# web page
开发者_开发百科I need to write a ASP.Net C# web page that can open a web page, fill in the fields and click the submit button on the web page automatically. My web page should launch the IE browser and navigate to a specified URL and fill the form and submit it. Not sure where I should start from. Any help is greatly appreciated.
Thank you.
I'm not sure that, browser will allow to run all your js code. But you can try with jquery, or with some another javascript lib.
You can add to your page iframe tag, than add dynamically another web-site to the iframe content. You also must know id's or classNames of html controls.
if you're going to use jquery
$(document).ready(function () {
$('#textbox1').val()="someText1";
....
$('#textboxN').val()="someTextN";
//call click event
$('#btnID').click();
});
to automatically start your page, you can use Process.Start() method in server side. if you're trying too run in client side, you can use Response.Redirect Method
Why not make a POST/GET call directly?
You could use HTTPWebRequest http://www.codeproject.com/KB/webservices/HttpWebRequest_Response.aspx
精彩评论