When using the IE driver with IE9, occasionally the Click method will only select a button, it wont do the action of the Click(). Note this only happens occasionally, so i d
After a bit more searching i found two things that seem to have helped in repeatable tests:
First i added an ImplicitlyWait of 5 seconds. Not sure if this is applied to all FindElement functions, but I have stopped getting most of the NoSuchElementException i was getting.
OpenQA.Selenium.IE.InternetExplorerDriver driver = new OpenQA.Selenium.IE.InternetExplorerDriver();
driver.Manage().Timeouts().ImplicitlyWait(new TimeSpan(0, 0, 0, 5, 0));
//driver.Manage().Speed = Speed.Medium;
Second i was having trouble with a Logout function and changed the code to:
public LoginPageObject Logout() {
Driver.FindElement(By.LinkText("Logout")).Click();
OpenQA.Selenium.Support.UI.IWait wait = new OpenQA.Selenium.Support.UI.WebDriverWait(Driver, TimeSpan.FromSeconds(5));
IWebElement element = wait.Until(driver => driver.FindElement(By.Name("username")));
LoginPageObject lpage = new LoginPageObject(Driver);
return lpage;
}
The explicit wait seems to handle what the ImplicitlyWait doesn't catch (i think because of redirects).
http://code.google.com/p/selenium/source/browse/trunk/support/src/csharp/webdriver-support/UI/WebDriverWait.cs?r=10855