Authenticating to Salesforce with Silenium in C#
It is pretty easy to authenticate to Salesforce with Silenium in C#. Here are the steps.
- Add the following NuGET package to your project:
 Silenium WebDriver
- Use the following code:
        public static void LoginToSalesforce(string username, string password)
        {
            IWebDriver driver = new FirefoxDriver();
            driver.Url = "https://test.salesforce.com";
            driver.Navigate();
            var userNameTextBox = driver.FindElement(By.Id("username"));
            userNameTextBox.SendKeys(username);
            var passwordTextBox = driver.FindElement(By.Id("password"));
            passwordTextBox.SendKeys(password);
            var loginButton = driver.FindElement(By.Id("Login"));
            loginButton.Submit();
        }
Yes it is that easy.

