For Sales Enquiry, call: +91 789 216 9998 For HR Enquiry, call: +91 804 166 0003 Skype: globussoftsupport

Progressing towards Innovation...

 

Web Automation (Browser Control) - Globussoft

June 20, 2014by GLBADMIN2

Hi, I am Amit Soni, a Senior .NET Developer at Globussoft with 4+ years of experience on asp.net and c#.net frameworks. I have put together my ideas on how to do a simple web automation here.

Web Technologies and Automation

Web technology is a term increasingly used in the same wavelength as automation.

As always with newer technologies or fields of use, a certain confusion remains about terminology in the early days. The development of computer software is not an easy task. Besides development of the concept that lies behind the software, the software engineers also need to devise means and methodologies in order to guarantee complete application of the concept by the software that is being developed. Moreover, it is important for engineers to ensure that the developed software is devoid of any kind of glitches and bugs before they are released commercially. This is exactly where the need for automated software comes into existence.

Applications and Advantages of Control Technology

Many Technologies have been developed for Web Automation. Here I am introducing two basic web automation components which we use for Web Automation:

  1. Web browser control
  2. Watin web browser control

Both are based on internet explorer.

Web browser control is a very interesting programming part of automation. I have worked on a number of web automation and web robots projects and used web browser control effectively. Web browser control provides a user interface which is same as manual work. Simple Socket program has many issues like running JavaScript, but web browser rules out these issues by itself. I would now demonstrate the web browser concept with some of the codes of my project.

The above image shows the page where we use web browser control. Web window redirects you to the site which you want to automate and then by using the Web browser control you can use handle Site’s controls like buttons and events.

For Redirect we use –

webHotmail.Navigate(“https://signup.live.com/”);

For Controls –

webHotmail.Document.GetElementById("iFirstName").SetAttribute("value", fName);
webHotmail.Document.GetElementById("iLastName").SetAttribute("value", lName);
webHotmail.Document.GetElementById("iBirthYear").SetAttribute("value", yy);
webHotmail.Document.GetElementById("iBirthMonth").SetAttribute("value", mm);

For Events –

webHotmail.Document.GetElementById("iSA").SetAttribute("value", petname);
if (gender == true)
{
    IHTMLElement h1 = (IHTMLElement)webHotmail.Document.GetElementById("iGenderMale").DomElement;
    h1.click();
}

 

Automated Web Testing Using WatiN

WatiN (what-in), stands for Web Application testing in .NET, is a very easy automated web application testing framework. WatiN is developed in C# for web testing with Internet Explorer and FireFox.

According to Scott Guthrie, this will give you exactly the experience that you’ll have when a customer hits the site, which ends up being a far more accurate assessment of the application quality.

We are using the same task type as web browser but code structure is different.

For example

using Microsoft.VisualStudio.TestTools.UnitTesting;
using WatiN.Core;
[TestClass]
public class WatiNTest
{
    [TestMethod]
    public void GoogleTest()
    {
        bool hasText;
        using (IE ie = new IE())
        {
            ie.GoTo("http://www.google.com");
            ie.TextField(Find.ByName("q")).TypeText("Dixin");
            ie.Button(Find.ByName("btnG")).Click();
            hasText = ie.ContainsText("Dixin");
        }
   }
}

 

Significant Advantages of Conducting Automated Software Testing

Easy to perform certain tests repeatedly: Most software testing tools allow testers to configure the tests once based on certain parameters. You can use the configuration to administer the test over and over without putting any extra effort.

Smooth running of loads of tests and cases: As the running and rerunning of test scripts manually needs a huge amount of time, it may prolong the project completion date. So many testers use testing tools to easily execute the test scripts till they are sure about the accuracy of test results.

Saves your time and resources: You can always save both time and resources by automating the testing process. As the test scripts can be reused to target several user interfaces, and the tests can be administered in less time, you can easily develop a quality application, while saving funds.

Make your software more reliable: Each testing tool further allows you to build a suite of test to cover all features and functionality of the application. The comprehensive testing can emulate user behavior accurately that will contribute toward boosting the efficiency, performance and reliability of the application.

Reusability of the test: A tester has options to choose from a variety of test automation tools. However, the prices of the testing tools will vary based on the expected features and functionality. These features make it easier for software testers to reuse a single test script to administer application testing.

Quick testing of cross-platform applications: Each successful application has to be compatible with major operating systems and devices. So most companies, nowadays, develop cross-platform software applications. If you are developing a web application, it must run on major web browsers like Internet Explorer, Firefox, Chrome and Opera.

Thank You! It’s a pleasure to share. You can share your ideas with me here too.

GLBADMIN

2 comments

  • Kacie Burrel

    August 25, 2020 at 9:47 am

    I intended to post you that very small note just to give many thanks as before for these pretty tricks you have featured on this site. It has been quite pretty open-handed with people like you to provide unhampered what exactly many of us could possibly have offered for sale as an electronic book to get some profit on their own, and in particular given that you might well have tried it if you desired. The concepts likewise acted to become fantastic way to realize that many people have the same eagerness really like mine to figure out a good deal more regarding this problem. I’m sure there are some more fun times up front for folks who go through your site.

    Reply

  • iodine liquid formula

    September 30, 2020 at 12:09 am

    Today, I went to the beachfront with my kids. I found a sea shell and gave it to my 4 year old daughter and said “You can hear the ocean if you put this to your ear.” She put the shell to her ear and screamed. There was a hermit crab inside and it pinched her ear. She never wants to go back! LoL I know this is totally off topic but I had to tell someone!

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Globussoft
Social Networks
globussoftsupport
support@globussoft.com

Copyright © 2006-2020 Globussoft Technologies

ss
top