public static void ClickHoldAndDrag(By startElement, By endElement) { Actions act = new Actions(ObjectRepository.Driver); IWebElement start = GenericHelper.GetElement(startElement); IWebElement target = GenericHelper.GetElement(endElement); act.ClickAndHold(start).MoveToElement(target).Release().Build().Perform(); Thread.Sleep(3000); }
public static void DragNDrop(By startElement, By endElement) { Actions act = new Actions(ObjectRepository.Driver); IWebElement start = GenericHelper.GetElement(startElement); IWebElement target = GenericHelper.GetElement(endElement); act.DragAndDrop(start, target).Build().Perform(); Thread.Sleep(3000); }
// Once the element is visible, return that element public static IWebElement WaitForElement(By locator, int totalSeconds, int checkInterval) { ObjectRepository.Driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(1); WebDriverWait wait = new WebDriverWait(ObjectRepository.Driver, TimeSpan.FromSeconds(totalSeconds)); wait.PollingInterval = TimeSpan.FromMilliseconds(checkInterval); wait.IgnoreExceptionTypes(typeof(NoSuchElementException), typeof(ElementNotVisibleException)); wait.Until(ExpectedConditions.ElementIsVisible(locator)); IWebElement element = GenericHelper.GetElement(locator); return(element); }
public static string GetButtonText(By locator) { element = GenericHelper.GetElement(locator); if (element.GetAttribute("value") == null) { return(string.Empty); } else { return(element.GetAttribute("value")); } }
public static bool IsCheckBoxchecked(By locator) { element = GenericHelper.GetElement(locator); string flag = element.GetAttribute("checked"); if (flag == null) { return(false); } else { return(flag.Equals("true") || flag.Equals("checked")); } }
public static void ClickButton(By locator) { //WaitHelper.WaitForElement(locator); element = GenericHelper.GetElement(locator); element.Click(); }
public static bool IsButtonEnabled(By locator) { element = GenericHelper.GetElement(locator); return(element.Enabled); }
public static void CheckOnCheckBox(By locator) { element = GenericHelper.GetElement(locator); element.Click(); }
public static void ClearTextBox(By locator) { element = GenericHelper.GetElement(locator); element.Clear(); }
public static void ClickLink(By locator) { element = GenericHelper.GetElement(locator); element.Click(); }
public static void SwitchToFrame(By locator) { ObjectRepository.Driver.SwitchTo().Frame(GenericHelper.GetElement(locator)); }
public static void ClickRadioButton(By locator) { element = GenericHelper.GetElement(locator); element.Click(); }
public static void TypeInTextBox(By locator, string inputText) { element = GenericHelper.GetElement(locator); element.SendKeys(inputText); }
public static IList <string> GetAllItems(By locator) { select = new SelectElement(GenericHelper.GetElement(locator)); return(select.Options.Select(x => x.Text).ToList()); }
public static void SelectElementByText(By locator, string visibleText) { select = new SelectElement(GenericHelper.GetElement(locator)); select.SelectByText(visibleText); }
public static void SelectElementByIndex(By locator, int index) { select = new SelectElement(GenericHelper.GetElement(locator)); select.SelectByIndex(index); }