browse by category or date

Recently we received a request to provide solution on automating Internet Explorer. In the past, I had similar project which utilises .NET’s web browser control. It was horrid and painful experience 😀 Not wanting to repeat the same nightmare, I googled for better tools.

Then I found WatiN (Web Application Testing in .NET). My preliminary trials has been positive. Just check out below code.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using WatiN.Core;

namespace IEAutomator
    class Program
        static void Main(string[] args)
            //Open an URL
            var browser = new IE("");

            //Find a textbox by its elementID and set its value
            var txtLogin = browser.TextField("user_login");
            txtLogin.Value = "admin";

            //Find a password textbox by its elementID and set its value
            var txtPassword = browser.TextField("user_pass");
            txtPassword.Value = "testPass";

            //Find the submit button and then click it
            var btnLogin = browser.Button("wp-submit");
            //Delay to ensure we can see the result in IE

            //Close IE

I hope I can write more about how WatiN helps me to provide the solution required by my Customer.

GD Star Rating
Automating Internet Explorer using WatiN, 3.0 out of 5 based on 1 rating

Possibly relevant:

About Hardono

Howdy! I'm Hardono. I am working as a Software Developer. I am working mostly in Windows, dealing with .NET, conversing in C#. But I know a bit of Linux, mainly because I need to keep this blog operational. I've been working in Logistics/Transport industry for more than 11 years.

No Comment

Add Your Comment