Search code examples
javascriptc#websimulationimacros

Simulate the use of a website with a client


I would like to achieve the following scenario:

Create a client that opens a web site, for example www.stackoverflow.com, click a button with an id (for example the button "Ask Question"), fill the forms (knowing the ids of the fields) and press another button.

No, I do not want to do bad things :D I'm only trying to create a demo to customers about a website (I do not have source of this website) and I would like to know if there's a way to program a client in order to reproduce some steps.

Thanks a lot!


Solution

  • If you want it for .net, then there is WatiN.

    Here is an example how to use it:

    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();
    
        bool contains = browser.ContainsText("WatiN");
      }
    }
    

    p.s. You can also try Test Recorder for generating macros.