Example #1
0
 public static IWebDriver ClickOnObjectLinkInField(this IWebDriver webDriver, string fieldId)
 {
     webDriver.GetField(fieldId).FindElement(By.TagName("a")).BrowserSpecificClick(webDriver);
     Thread.Sleep(1000); // hack for unknown error
     webDriver.WaitForAjaxComplete();
     return(webDriver);
 }
Example #2
0
        public static IWebElement GetField(this IWebDriver webDriver, string fieldId)
        {
            IWebElement field = webDriver.FindElement(By.Id(fieldId));

            webDriver.WaitForAjaxComplete();
            return(field);
        }
Example #3
0
        public static IWebElement ClickRecentlyViewed(this IWebDriver webDriver, string fieldId)
        {
            IWebElement field = webDriver.GetField(fieldId);

            field.FindElement(By.CssSelector("[title='Recently Viewed']")).BrowserSpecificClick(webDriver);
            webDriver.WaitForAjaxComplete();
            return(field);
        }
Example #4
0
        public static IWebElement ClickFinderAction(this IWebDriver webDriver, string fieldId, string actionId)
        {
            IWebElement field = webDriver.GetField(fieldId);

            field.FindElement(By.Id(actionId)).BrowserSpecificClick(webDriver);
            webDriver.WaitForAjaxComplete();
            return(field);
        }
Example #5
0
        public static IWebElement SelectFinderOption(this IWebDriver webDriver, string fieldId, string name)
        {
            IWebElement field = webDriver.GetField(fieldId);
            IWebElement row   = GetFinderSelections(field).FindElements(By.TagName("tr")).Where(x => x.Text.Contains(name)).FirstOrDefault();

            row.FindElement(By.Name("Selector")).BrowserSpecificClick(webDriver);
            webDriver.WaitForAjaxComplete();
            return(field);
        }
Example #6
0
        private static IWebDriver ClickSingleGenericButton(this IWebDriver webDriver, string title)
        {
            IWebElement button = webDriver.FindElement(By.CssSelector("button[title=" + title + "]"));

            //webDriver.ScrollTo(button);
            button.BrowserSpecificClick(webDriver);
            webDriver.WaitForAjaxComplete();
            return(webDriver);
        }
Example #7
0
        public static IWebDriver GoBackViaHistoryBy(this IWebDriver webDriver, int numberOfObjects)
        {
            IWebElement history = webDriver.GetHistory();
            ReadOnlyCollection <IWebElement> links = history.FindElements(By.TagName("a"));
            int count = links.Count();

            links[count - 1 - numberOfObjects].BrowserSpecificClick(webDriver);
            webDriver.WaitForAjaxComplete();
            return(webDriver);
        }
Example #8
0
        public static IWebElement ViewAs(this IWebDriver webDriver, string collectionId, string buttonName)
        {
            IWebElement collection = GetInternalCollection(webDriver, collectionId);

            AssertIsCollection(collection);
            IWebElement button = collection.FindElement(By.ClassName(buttonName));

            button.BrowserSpecificClick(webDriver);
            webDriver.WaitForAjaxComplete();
            return(collection);
        }
Example #9
0
        private static IWebDriver ClickClearContextMenu(this IWebDriver webDriver, int index, ClearType clearType)
        {
            var tab   = webDriver.FindElements(By.CssSelector(".nof-tab"))[index];
            var loc   = (ILocatable)tab;
            var mouse = ((IHasInputDevices)webDriver).Mouse;

            mouse.ContextClick(loc.Coordinates);
            webDriver.WaitForAjaxComplete();

            tab.FindElements(By.CssSelector("li a"))[(int)clearType].Click();
            webDriver.WaitForAjaxComplete();

            var firstTabImg = webDriver.FindElements(By.CssSelector(".nof-tab img")).FirstOrDefault();

            if (firstTabImg != null)
            {
                firstTabImg.Click();
            }

            return(webDriver);
        }
Example #10
0
        public static IWebElement SelectListBoxItems(this IWebElement field, IWebDriver br, params string[] names)
        {
            IWebElement select = field.FindElement(By.TagName("select"));

            IWebElement[] options = select.FindElements(By.TagName("option")).Where(o => names.Contains(o.Text)).ToArray();
            Assert.AreEqual(names.Count(), options.Count(), "all options not found in list");


            foreach (string name in names)
            {
                IWebElement option = options.Single(o => o.Text == name);

                IKeyboard kb = ((IHasInputDevices)br).Keyboard;

                kb.PressKey(Keys.Control);
                option.Click();
                kb.ReleaseKey(Keys.Control);
            }
            select.SendKeys(Keys.Tab);
            br.WaitForAjaxComplete();

            return(field);
        }
Example #11
0
 public static IWebDriver ClickAction(this IWebDriver webDriver, string actionId)
 {
     GetAction(webDriver, actionId).BrowserSpecificClick(webDriver);
     webDriver.WaitForAjaxComplete();
     return(webDriver);
 }
Example #12
0
 public static IWebDriver ClickTabLink(this IWebDriver webDriver, int index)
 {
     webDriver.FindElements(By.CssSelector(".nof-tab a"))[index].BrowserSpecificClick(webDriver);
     webDriver.WaitForAjaxComplete();
     return(webDriver);
 }
Example #13
0
        public static IWebElement SelectListBoxItems(this IWebElement field, IWebDriver br, params string[] names) {
            IWebElement select = field.FindElement(By.TagName("select"));
            IWebElement[] options = select.FindElements(By.TagName("option")).Where(o => names.Contains(o.Text)).ToArray();
            Assert.AreEqual(names.Count(), options.Count(), "all options not found in list");


            foreach (string name in names) {
                IWebElement option = options.Single(o => o.Text == name);

                IKeyboard kb = ((IHasInputDevices) br).Keyboard;

                kb.PressKey(Keys.Control);
                option.Click();
                kb.ReleaseKey(Keys.Control);
            }
            select.SendKeys(Keys.Tab);
            br.WaitForAjaxComplete();

            return field;
        }