Q:

How to send keys to the website using their element IDs in C# ASP.Net?

In the following application, I used HTML agility pack to extract the HTML document from the given url. Now I need to know how can i use the element ids from the HTML document and enter text in the fields and in the end hit SUBMIT button to submit the form.
protected void Button1_Click(object sender, EventArgs e)
{
    string Url = "https://something.com/login.asp"; 
    HtmlWeb web = new HtmlWeb(); 
    HtmlAgilityPack.HtmlDocument doc = web.Load(Url);
}

The current application automate the web data entry.

A:

protected void Button1_Click(object sender, EventArgs e)         
{
    IWebDriver driver = 
        new InternetExplorerDriver(@"C:\.....\IEDriverServer_Win32_2.25.2"); 

    driver.Navigate().GoToUrl("https://website.com/login.asp");

    // Find the text input element by its name
    // username

    IWebElement name_ID = driver.FindElement(By.Name("name_ID"));
    name_ID.SendKeys("xyzw");

    // password
    IWebElement pwd_PW = driver.FindElement(By.Name("pwd_PW"));
    pwd_PW.SendKeys("fasdfasfdasdf");

    // submit login form
    IWebElement sSubmit = driver.FindElement(By.Name("submit"));
    submit.Submit();
    System.Threading.Thread.Sleep(5000);
    driver.Quit();
}

