I'm learning how to write selenium tests in C# and am getting this error when trying to run the test case below. It is failing on: IWebElement query = driver.FindElement(By.Name("q"));
Test method SeleniumDemo.SearchGoogle.SearchForCheese threw exception:
System.ArgumentException: elementDictionary (Parameter 'The specified dictionary does not contain an element reference')
Code:
[TestMethod]
public void SearchForCheese()
{
using (var driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)))
{
driver.Navigate().GoToUrl("http://www.google.com");
// Find text input
IWebElement query = driver.FindElement(By.Name("q"));
// Enter something to search for
query.SendKeys("cheese");
// Submit form
query.Submit();
var wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));
wait.Until(d => d.Title.Contains("cheese"));
Assert.AreEqual(driver.Title, "cheese - Google Search");
};
}
Any ideas? Thank you in advance!
Aucun commentaire:
Enregistrer un commentaire