root/honeyclient/branches/exp/bhenderson-browser_automation/BrowserAutomation/Automation.cs

Revision 1733, 1.4 kB (checked in by bhenderson, 5 months ago)

Updated using WatiN and added Firefox 2.0 Functionality

  • Property svn:executable set to *
Line 
1 using System;
2 using System.Collections.Generic;
3 using System.Diagnostics;
4 using System.Linq;
5 using System.Text;
6
7 /// <summary>
8 /// Summary description for Browser Automation.
9 /// This application is designed to navigate to a URL using a specified browser allow all content to load and execute before closing the browser
10 /// </summary>
11 namespace BrowserAutomation
12 {
13     class Automation
14     {
15         private static IE ie;
16         private static Firefox firefox;
17         private static Process[] myOpenFirefoxs;
18
19         /// <summary>
20         /// The main entry point for the application.
21         /// </summary>
22         /// <param name="args">Should Contain two variables
23         /// 1) Browser to be used (ex. "ie" "firefox")
24         /// 2) URL to navigate to</param>
25         static void Main(string[] args)
26         {
27             if (args.Length == 2)
28             {
29                 if (args[0].Equals("ie"))
30                 {
31                     ie = new IE(args[1]);
32                 }
33                 if (args[0].Equals("firefox"))
34                 {
35                     myOpenFirefoxs = Process.GetProcessesByName("firefox");
36                     foreach (Process myOpenFirefox in myOpenFirefoxs)
37                     {
38                         myOpenFirefox.Kill();
39                     }
40                     firefox = new Firefox(args[1]);
41                 }
42             }
43         }
44     }
45 }
Note: See TracBrowser for help on using the browser.