Exemplo n.º 1
0
        public static void CheckBoxOn(BrowserOp browser, string cName)
        {
            IWebDriver  BrowserDriver = browser.getDriver;
            IWebElement checkbox      = BrowserDriver.FindElement(By.Id(cName));

            if (!checkbox.Selected)
            {
                checkbox.Select();
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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();
        }
Exemplo n.º 5
0
        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();
        }
Exemplo n.º 6
0
        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;
                }
            }
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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();
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
 public EditOp(BrowserOp browser)
 {
     BrowserDriver = browser.getDriver;
 }
Exemplo n.º 11
0
 public CheckboxOp(BrowserOp browser)
 {
     BrowserDriver = browser.getDriver;
 }
Exemplo n.º 12
0
 public ButtonOp(BrowserOp browser)
 {
     BrowserDriver = browser.getDriver;
 }
Exemplo n.º 13
0
 public RadioOp(BrowserOp browser)
 {
     BrowserDriver = browser.getDriver;
 }
Exemplo n.º 14
0
 public HyperLinkOp(BrowserOp browser)
 {
     BrowserDriver = browser.getDriver;
 }
Exemplo n.º 15
0
 public ComboBoxOp(BrowserOp browser)
 {
     BrowserDriver = browser.getDriver;
 }