I’ve written the sample like in documentation:
var driver = new InternetExplorerDriver();
driver.Navigate().GoToUrl("http://google.com");
var query = driver.FindElement(By.Name("q"));
query.SendKeys("Cheese");
Console.WriteLine("Title is: " + driver.Title);
driver.Quit();
But I always get Unable to find element with name == q error.
The IE9 is opened, google page is loaded, I can read driver.Title, but cannot find any element by name, by selector, or by id.
Any thoughts?
UPD:
Terrible thing is that this code works on my desktop (Windows 7, VS 2010 Express) and doesn’t work in virtual machine (VmWare player, Windows 2008 R2 SP 1 trial, VS 2010 Ultimate trial) 🙁
And it doesn’t work there for custom dummy <input name="q" /> page
UPD 2:
The code works for Firefox driver, but doesn’t for IE.
SOLUTION:
Seems like the site should be in “Trusted” for Windows server installation. I’m not sure why, but adding google.com to trusted solved an issue
The site should be in “Trusted” for Windows server installation. I’m not sure why, but adding google.com to trusted solved an issue