public static void CheckBoxOn(BrowserOp browser, string cName) { IWebDriver BrowserDriver = browser.getDriver; IWebElement checkbox = BrowserDriver.FindElement(By.Id(cName)); if (!checkbox.Selected) { checkbox.Select(); } }
public static void EditInput(BrowserOp browser, string editName, string key) { IWebDriver BrowserDriver = browser.getDriver; IWebElement element; try { element = BrowserDriver.FindElement(By.Name(editName)); } catch (NoSuchElementException) { element = BrowserDriver.FindElement(By.Id(editName)); } element.SendKeys(key); }
public static void ExecuteJS(BrowserOp browser, string linkName, string JS) { IWebDriver BrowserDriver = browser.getDriver; IWebElement element; try { element = BrowserDriver.FindElement(By.LinkText(linkName)); } catch (NoSuchElementException) { element = BrowserDriver.FindElement(By.PartialLinkText(linkName)); } ((IJavaScriptExecutor)BrowserDriver).ExecuteScript(JS, element); }
public static void RadioSelect(BrowserOp browser, string rName, string rValue) { IWebDriver BrowserDriver = browser.getDriver; IWebElement radio; try { radio = BrowserDriver.FindElement(By.XPath("//input[@type='radio' and @name='" + rName + "' and @value='" + rValue + "']")); } catch (NoSuchElementException) { radio = BrowserDriver.FindElement(By.Id(rValue)); } radio.Click(); }
public static void LinkClick(BrowserOp browser, string linkName) { IWebDriver BrowserDriver = browser.getDriver; IWebElement element; try { element = BrowserDriver.FindElement(By.LinkText(linkName)); } catch (NoSuchElementException) { element = BrowserDriver.FindElement(By.PartialLinkText(linkName)); } element.Click(); }
public static void ComboBoxItemSelect(BrowserOp browser, string comboName, string ItemName) { IWebDriver BrowserDriver = browser.getDriver; ReadOnlyCollection <IWebElement> allOptions = BrowserDriver.FindElements(By.XPath("//select[@name='" + comboName + "']//option")); foreach (IWebElement element in allOptions) { if (element.Value == ItemName || element.Text == ItemName) { element.Select(); return; } } }
public static void ExecuteJS(BrowserOp browser, string buttonName, string JS) { IWebDriver BrowserDriver = browser.getDriver; IWebElement element; try { element = BrowserDriver.FindElement(By.Id(buttonName)); } catch (NoSuchElementException) { try { element = BrowserDriver.FindElement(By.Name(buttonName)); } catch (NoSuchElementException) { element = BrowserDriver.FindElement(By.XPath(buttonName)); } } ((IJavaScriptExecutor)BrowserDriver).ExecuteScript(JS, element); }
public static void buttonClick(BrowserOp browser, string buttonName) { IWebDriver BrowserDriver = browser.getDriver; IWebElement element; try { element = BrowserDriver.FindElement(By.Id(buttonName)); } catch (NoSuchElementException) { try { element = BrowserDriver.FindElement(By.Name(buttonName)); } catch (NoSuchElementException) { element = BrowserDriver.FindElement(By.XPath(buttonName)); } } element.Click(); }
public static string EditOutput(BrowserOp browser, string editName) { IWebDriver webdriver = browser.getDriver; IWebElement element; try { element = webdriver.FindElement(By.Name(editName)); } catch (NoSuchElementException) { element = webdriver.FindElement(By.Id(editName)); } string result = element.Value; if (result == "") { result = element.Text; } return(result); }
public EditOp(BrowserOp browser) { BrowserDriver = browser.getDriver; }
public CheckboxOp(BrowserOp browser) { BrowserDriver = browser.getDriver; }
public ButtonOp(BrowserOp browser) { BrowserDriver = browser.getDriver; }
public RadioOp(BrowserOp browser) { BrowserDriver = browser.getDriver; }
public HyperLinkOp(BrowserOp browser) { BrowserDriver = browser.getDriver; }
public ComboBoxOp(BrowserOp browser) { BrowserDriver = browser.getDriver; }