Esempio n. 1
0
 public static void TypeInTextBox(By locator, string text)
 {
     element = GenericHelper.GetElement(locator);
     element.Clear();
     element.SendKeys(text);
     Logger.Info("Type in textbox: " + locator.ToString() + " with value: " + text);
 }
 public static void BannerListener(By by, int interval = 1000)
 {
     try
     {
         Task.Factory.StartNew(() =>
         {
             while (ObjectRepository.Driver != null)
             {
                 try
                 {
                     GenericHelper.GetElement(by);
                     GenericHelper.GetElement(by).Click();
                 }
                 catch (Exception)
                 {
                     Thread.Sleep(interval);
                 }
             }
         });
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 3
0
        public static void DragAndMoveToRelativeCoordinates(By locator, int coordX, int coordY = 0)
        {
            actions = new Actions(ObjectRepository.Driver);
            IWebElement toggle = GenericHelper.GetElement(locator);

            actions.MoveToElement(toggle).ClickAndHold(toggle).MoveByOffset(coordX, coordY).Release().Build().Perform();
        }
        public static bool IsCheckBoxChecked(By locator)
        {
            element = GenericHelper.GetElement(locator);
            string classValue = element.GetAttribute("class");

            Logger.Info("Checking if checkbox checked or not : " + locator.ToString());
            if (classValue.Contains("checked"))
            {
                return(true);
            }
            return(false);
        }
Esempio n. 5
0
 public static bool IsTextBoxEmpty(By locator)
 {
     element = GenericHelper.GetElement(locator);
     Logger.Info("Checking if Text Box empty or not: " + locator.ToString());
     if (element.GetAttribute("value") == "")
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public static void SelectElement(By locator, string visibleText)
 {
     select = new SelectElement(GenericHelper.GetElement(locator));
     select.SelectByText(visibleText);
     Logger.Info("Select option with text: " + visibleText + " in ComboBox: " + locator.ToString());
 }
 public static void SelectElement(By locator, int index)
 {
     select = new SelectElement(GenericHelper.GetElement(locator));
     select.SelectByIndex(index);
     Logger.Info("Select option with index: " + index + " in ComboBox: " + locator.ToString());
 }
Esempio n. 8
0
 public static void HoverAndClick(By locator)
 {
     element = GenericHelper.GetElement(locator);
     actions = new Actions(ObjectRepository.Driver);
     actions.MoveToElement(element).Click().Build().Perform();
 }