Smart click (part 3)
In this part I decided to show some examples of using the SmartClick() method just to make the way it works easier to understand. Example 1 – the simplest. In 99% of cases you can use it without any parameters just like an IWebElement interface extension method: public void GoogleSearch() { IWebDriver driver = new FirefoxDriver(); driver.Navigate().GoToUrl(“http://www.google.com”); IWebElement query, btnSearch; WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(5)); query = driver.FindElement(By.Name(“q”)); query.Clear(); query.SendKeys(“selenium”); btnSearch = driver.FindElement(By.Name(“btnG”)); btnSearch.SmartClick(); wait.Until((d) => { return d.Title.StartsWith(“selenium”); }); Assert.AreEqual(“selenium – Google Search”, driver.Title); } In this case SmartClick works like native method Click() with some additional functionalities, such …