Ejemplo n.º 1
0
 public static ISelenium ClickButtonWithText(this ISelenium selenium, string text)
 {
     return selenium.ClickAndWait(string.Format("//input[@value='{0}']", text));
 }
Ejemplo n.º 2
0
 // Find then click action and wait unitil field selector returns an element 
 public static IWebElement ClickAndWait(this SafeWebDriverWait wait, string actionSelector, string fieldSelector, int delay = 0) {
     IWebElement action = wait.Driver.FindElement(By.CssSelector(actionSelector));
     return wait.ClickAndWait(action, fieldSelector);
 }
Ejemplo n.º 3
0
 // find then click action then wait until f returns true
 public static void ClickAndWait(this SafeWebDriverWait wait, string actionSelector, Func<IWebDriver, bool> f) {
     IWebElement action = wait.Driver.FindElement(By.CssSelector(actionSelector));
     wait.ClickAndWait(action, f);
 }
Ejemplo n.º 4
0
        private static void ClickClearContextMenu(this SafeWebDriverWait wait, int index, ClearType clearType) {
            var tabCount = wait.Driver.FindElements(By.CssSelector(".nof-tab")).Count;
            var newCount = clearType == ClearType.ClearThis ? tabCount - 1 : clearType == ClearType.ClearOthers ? 1 : 0;

            var webDriver = wait.Driver;
            var tab = webDriver.FindElements(By.CssSelector(".nof-tab"))[index];
            var loc = (ILocatable) tab;
            var mouse = ((IHasInputDevices) webDriver).Mouse;
            mouse.ContextClick(loc.Coordinates);

            var selector = string.Format(".ui-menu-item:nth-of-type({0}) a", (int)clearType);
            wait.Until(wd => wd.FindElement(By.CssSelector(selector)));
            wait.ClickAndWait(selector, wd => wd.FindElements(By.CssSelector(".nof-tab")).Count == newCount);
        }