Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

interacting with the browser using C#

Tags:

c#

windows

i wish to interact with my browser window may be IE great if it works on Firefox too, using C#.

I want to make a software which can fill the entries in a webform automatically. In old times there was gator now is roboform, where it can fill in the values automatically.

I actually have users who are comfortable working on an old windows forms application, so i want to make a solution where they can still enter the data in their windows application and it actually fills in the entries at the web form and acts as if the request had generated from the browser itself.

I know i can merge both the databases, since it is a legacy application re writing the database for windows app is a trouble..

Any suggestion?

like image 339
Anirudh Goel Avatar asked Feb 28 '23 12:02

Anirudh Goel


2 Answers

WatiN is designed to make testing web applications easy from .NET, and it sounds like it could be handy for what you want to do:

Following is the Hello world example of web test automation; searching Google.

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

WatiN Feature List

  • Automates all major HTML elements
  • Find elements by multiple attributes
  • Supports AJAX website testing
  • Supports frames (cross domain) and iframes
  • Supports popup dialogs like alert, confirm, login etc..
  • Supports HTML dialogs (modal and modeless)
  • Works with Internet Explorer 6, 7, 8 and FireFox 2 and 3
like image 107
AakashM Avatar answered Mar 07 '23 11:03

AakashM


It's billed as a testing application, but Selenium RC can be used to fill in forms and is fairly easy to setup. You could also check out WatiN. Don't know anything about what security issues you might see though.

like image 40
s_hewitt Avatar answered Mar 07 '23 11:03

s_hewitt