Example #1
0
        static void Main(string[] args)
        {
            var facebookDetails = new WebPageAuthenticationDetails
            {
                HomePageAddress = new Uri("https://www.facebook.com/"),
                UsernameLocator = By.Id("email"),
                PasswordLocator = By.Id("pass"),
                SubmitLocator   = By.XPath("//input[@value='Log in']"),
            };
            //Don't dispose this or the browser will be closed after logging in.
            var browserDriver = new FirefoxDriver();                     //Or use a different browser if you want (Firefox is easiest to use, though)
            var pageAccessor  = new WebPageAccessor(browserDriver, facebookDetails);

            pageAccessor.LogIn("example_username", "example_password");
        }
Example #2
0
 public WebPageAccessor(IWebDriver driver, WebPageAuthenticationDetails details)
 {
     this.driver      = driver;
     this.pageDetails = details;
 }