If I understood correctly, you want to open some URL in a web browser, and then interact with the site as usual. For such a task, I can offer a look at Selenium . Although it is commonly used as a regression test automation tool, no one can stop you from using it as a browser automation tool.
Selenium described the documentation in detail and the large community. Most likely, you will want to use Selenium WebDriver , which is available through nuget .
Below is a small example of a typical selenium "script" (taken as is from the documentation):
// Create a new instance of the Firefox driver. // Notice that the remainder of the code relies on the interface, // not the implementation. // Further note that other drivers (InternetExplorerDriver, // ChromeDriver, etc.) will require further configuration // before this example will work. See the wiki pages for the // individual drivers at http://code.google.com/p/selenium/wiki // for further information. IWebDriver driver = new FirefoxDriver(); //Notice navigation is slightly different than the Java version //This is because 'get' is a keyword in C
Personally, I can suggest thinking and organizing scripts in terms of user actions (register, login, fill out a form, select something in the grid, filter grid, etc.). This will give good form and readability for scripts instead of messy hard-coded code fragments. The script in this case might look something like this:
// Fill username and password // Click on button "login" // Wait until page got loaded LoginAs(" johndoe@domain.com ", "johndoepasswd"); // Follow link in navigation menu GotoPage(Pages.Reports); // Fill inputs to reflect year-to-date filter // Click on filter button // Wait until page refreshes ReportsView.FilterBy(ReportsView.Filters.YTD(2012)); // Output value of Total row from grid Console.WriteLine(ReportsView.Grid.Total);
source share