mrlingam
mrlingam

Reputation: 511

how to fill in html textbox from (c# ) windows application

I would like to do the following from a windows application:

  1. Open a browser and navigate to a URL.
  2. When i am at the correct URL in my browser window, i want to fill in data in the html textboxes on that page from my windows application.
  3. When that is done i want to press a button.

Note: Google Chrome and Mozilla Firefox is currently used in my browser Window. Internet Explorer(IE) is not used in browser Window.

1.The URL (https://www.exple.com/login.html ) had already opened on anyone web browsers such as Mozilla Firefox and Google Chrome in local System. It consists of Two Textboxes such as Username and Password .

2.I Want to fill in data in Username & Password Textbox on Google Chrome/Mozilla Firefox Web Browser.

3.The Input data is taken from C# Windows Application to URL When pressed Submit Button in Windows Application.

Thanks in Advance .

Upvotes: 1

Views: 2337

Answers (2)

Skiminok
Skiminok

Reputation: 2871

That's what WatiN is for. It was primarily created for web application testing, but your problem can be solved with WatiN as well.

Example from the front page:

[Test] 
public void SearchForWatiNOnGoogle()
{
    using (var browser = new IE("http://www.google.com"))
    {
        browser.TextField(Find.ByName("q")).TypeText("WatiN");
        browser.Button(Find.ByName("btnG")).Click();

        Assert.IsTrue(browser.ContainsText("WatiN"));
    }
}

This example uses IE, but Firefox is supported as well.

Upvotes: 1

Likurg
Likurg

Reputation: 2760

You can do it, but it will really hard,but if you make autoscript in testcomplete and then get code from it, code will be ugly , but working

Upvotes: 1

Related Questions