Author: <span>Oleh Husiev, Anastasia Husieva</span>

Smart click (part 2)

Here is the explanation how you can implement your own Click() method and what is behind the scenes. I will describe the method using a pure IWebElement instance. To be able to invoke the method out of an IWebElement, it should be declared as an IWebElement interface extension method. The method will have a couple of overridden versions for different sets of input parameters. Ok, let’s start. First of all let’s define what the method should do: It checks if the clicking action may be done It checks if all the necessary conditions for successful clicking are met (for example, some …

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 …

Adjustment of testing environment via Registry

Sometimes  you have to adjust parameters of your testing environment before running your tests. It may be some security settings, turning on or off some plug-ins, settings of browsers or other applications. As an example let’s look at the settings of Internet Explorer browser. Using this browser many automation testers often face with the following error: “Unexpected error launching Internet Explorer. Protected Mode settings are not the same for all zones. Enable Protected Mode must be set to the same value (enabled or disabled) for all zones. (NoSuchDriver)” This error occurs when Protected  Mode for different zones are not the …