Re: Login on Internet Explorer website

From: Dmitriy Lapshin [C# / .NET MVP] (x-code_at_no-spam-please.hotpop.com)
Date: 07/26/04


Date: Mon, 26 Jul 2004 10:26:39 +0300

Hi Jeff,

This can be done with the DOM, something like you'd do it from JavaScript
code within the Web page. Get the Window object (IHTMLWindow[2, 3, 4]) from
the IE instance, then query for the window's Document (IHTMLDocument[2, 3,
4, 5]]) , and then use the DOM as you would do that from JavaScript (the
code snippet below is rather a pseudo-code than a working C# code):

theDocument.all["userName"].text = "JohnDoe"
theDocument.all["password"].text = "password"
theDocument.forms[0].submit();

-- 
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"Jeff" <Jeff@discussions.microsoft.com> wrote in message
news:FC43A21A-DB07-4D58-BE51-DCACC30577BB@microsoft.com...
> Hi,
>
> I'm trying to automate a login and file download process.  This occurs
over the web.
>
> I have the code that opens Internet Explorer and navigates to the website.
The first page that comes up is a login page.  My goal is to have c# add the
user name and password to the appropriate text boxes.  After that I would
like c# to simulate button clicks (I can get the actual url if need be) to
select and download the appropriate file.
>
> Can someone point me in the right direction for coding this?
>
> Thanks,
> Jeff

Loading