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("http://sodeve.net/wp-admin");

            //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

Incoming Search Term

Advertise Here

No Comment

Add Your Comment