I'm trying to get to work Selenium Internet Explorer WebDriver, but it keeps throwing an exception as soon as I try to find an element inside the loaded page.
I'm using .NET implementation of Selenium client and version 2.44, Internet Explorer 11 (I've tried 32-bit and 64-bit versions) running on a Windows 8.1 x64 machine.
This is the C# test code I'm using:
IWebDriver driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl("http://mytesturl.com");
const string name = "Test";
IWebElement nameElement = driver.FindElement(By.Name("name"));
nameElement.SendKeys(name);
//...
This is the Web page on which I'm running the test:
<!DOCTYPE html>
<html>
<head runat="server">
<meta name="viewport" content="width=device-width" />
<title>TestSelenium</title>
</head>
<body>
<div>
<form action="<%: Url.Action("TestSeleniumFormResponse") %>" method="post">
Insert name: <input name="name" type="text"/>
<button type="submit">Submit</button>
</form>
</div>
</body>
</html>
The exception is raised as soon as it gets to the driver.FindElement(By.Name("name"))
call. Until then, the execution works as expected (launches IE when the webdriver is instantiated and navigates to the URL correctly).
This is the exception I'm getting:
OpenQA.Selenium.NoSuchElementException : Unable to find element with name == name
en OpenQA.Selenium.Remote.RemoteWebDriver.UnpackAndThrowOnError(Response errorResponse)
en OpenQA.Selenium.Remote.RemoteWebDriver.Execute(String driverCommandToExecute, Dictionary`2 parameters)
en OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(String mechanism, String value)
en OpenQA.Selenium.Remote.RemoteWebDriver.FindElementByName(String name)
en OpenQA.Selenium.By.<>c__DisplayClassa.<Name>b__8(ISearchContext context)
en OpenQA.Selenium.By.FindElement(ISearchContext context)
en OpenQA.Selenium.Remote.RemoteWebDriver.FindElement(By by)
I've got all security zones in IE set to have the same protected mode settings (tried with all enabled and all disabled), enhanced protection mode disabled, and have set the registry entries as specified in the required configuration section of the official website (https://code.google.com/p/selenium/wiki/InternetExplorerDriver). I've tried to explicitly wait up to 60 seconds, in case the webpage wasn't loaded by the time the execution reaches that point. No luck.
Thanks for your help.