I am trying to automate logging into a website using Selenium's Chrome Webdriver and C#. Running the following code throws the error listed in screenshot one and two. What am I doing wrong? Googling the error does not seem to show any relevant results.
using System.Drawing.Imaging;
using System.IO;
using OpenQA.Selenium.Chrome;
namespace WebDriverTest
{
class Program
{
static void Main(string[] args)
{
// Initialize the Chrome Driver
using (var driver = new ChromeDriver())
{
// Go to the home page
driver.Navigate().GoToUrl("https://twitter.com/");
// Get User Name field, Password field and Login Button
var userNameField = driver.FindElementById("usr");
}
}
}
}
An unhandled exception of type 'OpenQA.Selenium.WebDriverException' occurred in WebDriver.dll.
Additional information: A exception with a null response was thrown
sending an HTTP request to the remote WebDriver server for
URL http://localhost:61724/session/cc7bae393b288855ed8169dade774baa/element.
The status of the exception was ReceiveFailure, and the message was:
The underlying connection was closed: An unexpected error occurred on a receive.