Esempio n. 1
0
        /// <summary>
        /// Method selects option in 'Records per page' dropdown by value or text
        /// </summary>
        /// <param name="by"></param>
        /// <param name="value"></param>
        public void SelectOptionRecordsPerPageDropDown(SelectBy by, string value)
        {
            IWebElement dropDown = commonMethods.GetElementByWithLogs(driver, RowsPerPageDropdownLocator, "Can NOT find 'Records per page' dropdown");

            commonMethods.SelectOptionInDropDownBy(by, dropDown, value);
            LogUtil.WriteDebug("Selected option " + value + " in 'Records per page' dropdown");
        }
Esempio n. 2
0
        /// <summary>
        /// Methods clicks select year in 'Year' dropdown of Date Picker Calendar
        /// </summary>
        public void SelectYearInDatePickerCalendar1(SelectBy by, string year)
        {
            IWebElement dropDown = commonMethods.GetElementByWithLogs(driver, YearDropdownInDatePickerCalendarLocator, "Can NOT find 'Year' DropDown of Date Picker Calendar");

            commonMethods.SelectOptionInDropDownBy(by, dropDown, year);
            LogUtil.WriteDebug("Selected year " + year + " in 'Year' dropdown of Date Picker Calendar");
        }
        /// <summary>
        /// Method selects option in 'Staus' dropdown by value or text on Applied Leave page
        /// </summary>
        /// <param name="by"></param>
        /// <param name="value"></param>
        public void SelectOptionInStatusDropDownOfAppliedLeave(SelectBy by, string value)
        {
            var dropDown = commonMethods.GetElementByWithLogs(driver, AppliedLeaveStatusDropdownLocator, "Can NOT find 'Status' dropdown on Applied Leave page");

            commonMethods.SelectOptionInDropDownBy(by, dropDown, value);
            LogUtil.WriteDebug("Selected option " + value + " in 'Status' dropdown on Applied Leave page ");
        }
Esempio n. 4
0
        /// <summary>
        /// Methods clicks select year in 'Year' dropdown of Date Picker Calendar
        /// </summary>
        public void SelectMonthInDatePickerCalendar1(SelectBy by, string month)
        {
            IWebElement dropDown = commonMethods.GetElementByWithLogs(driver, MonthDropdownInDatePickerCalendarLocator, "Can NOT find 'Month' DropDown of Date Picker Calendar");

            commonMethods.SelectOptionInDropDownBy(by, dropDown, (Int32.Parse(month) - 1).ToString());
            LogUtil.WriteDebug("Selected month " + month + " in 'Month' dropdown of Date Picker Calendar");
        }
Esempio n. 5
0
        // Get child element from parent element based on selector
        public static AndroidElement GetChildElement(AndroidElement parent, SelectBy by, string selector)
        {
            AndroidElement e = null;

            switch (by)
            {
            case SelectBy.ID:
                e = (AndroidElement)parent.FindElementById(selector);
                break;

            case SelectBy.Class:
                e = (AndroidElement)parent.FindElementByClassName(selector);
                break;

            case SelectBy.XPath:
                e = (AndroidElement)parent.FindElementByXPath(selector);
                break;

            case SelectBy.ExactText:
                e = (AndroidElement)parent.FindElementByAndroidUIAutomator(String.Format("new UiSelector().text(\"{0}\")", selector));
                break;

            case SelectBy.ContainsText:
                e = (AndroidElement)parent.FindElementByAndroidUIAutomator(String.Format("new UiSelector().textContains(\"{0}\")", selector));
                break;

            case SelectBy.RegexText:
                e = (AndroidElement)parent.FindElementByAndroidUIAutomator(String.Format("new UiSelector().textMatches(\"{0}\")", selector));
                break;
            }
            return(e ?? throw new NotFoundException("Child with selector " + selector + " not found."));
        }
Esempio n. 6
0
        /// <summary>
        /// Method selects option in 'Staus' dropdown by value or text in Leave Request window
        /// </summary>
        /// <param name="by"></param>
        /// <param name="value"></param>
        public void SelectOptionInStatusDropDown(SelectBy by, string value)
        {
            var dropDown = commonMethods.GetElementByWithLogs(driver, LeaveRequestStatusDropdownLocator, "Can NOT find 'Status' dropdown in Leave Request window ");

            commonMethods.SelectOptionInDropDownBy(by, dropDown, value);
            LogUtil.WriteDebug("Selected option " + value + " in 'Status' dropdown in Leave Request window ");
        }
Esempio n. 7
0
        /// <summary>
        /// Select drop down value changing
        /// </summary>
        /// <param name="parameter">control parameter</param>
        /// <param name="text">text need to set</param>
        /// <param name="findElement">find control from parameter</param>
        /// <param name="selectBy">Select option</param>
        /// <param name="elementPosition">position of the control</param>
        public void Select(string parameter, string text, FindElement findElement, SelectBy selectBy, int elementPosition = 0)
        {
            try
            {
                IWebElement element = GetElement(parameter, findElement, elementPosition);
                if (element != null)
                {
                    var selectElement = new SelectElement(element);
                    switch (selectBy)
                    {
                    case SelectBy.Text:
                    {
                        selectElement.SelectByText(text);
                        break;
                    }

                    case SelectBy.Value:
                    {
                        selectElement.SelectByValue(text);
                        break;
                    }

                    case SelectBy.Index:
                    {
                        selectElement.SelectByIndex(Convert.ToInt32(text));
                        break;
                    }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public ProgramAutoInfo(SelectBy selectBy, string programPath, string windowName, string deviceId, bool instantHook)
 {
     this.selectBy    = selectBy;
     this.programPath = programPath;
     this.windowName  = windowName;
     this.deviceId    = deviceId;
     this.instantHook = instantHook;
 }
Esempio n. 9
0
        protected internal override void ApplyMetadata(UIComponentMetadata metadata)
        {
            selectByAttribute = metadata.Get <SelectByTextAttribute>(AttributeLevels.Declared)
                                ?? (TermSettingsAttribute)metadata.Get <SelectByValueAttribute>(AttributeLevels.Declared)
                                ?? new SelectByTextAttribute();

            by = selectByAttribute is SelectByTextAttribute ? SelectBy.Text : SelectBy.Value;

            base.ApplyMetadata(metadata);
        }
 public void ElementSelection_First_SelectBy()
 {
     this.RunInAllBrowsers(browser =>
     {
         browser.NavigateToUrl("/test/TemporarySelector");
         browser.SelectMethod = s => SelectBy.CssSelector(s, "[data-ui='{0}']");
         browser.First("p", By.TagName).CheckIfTextEquals("p");
         browser.First("id", By.Id).CheckIfTextEquals("id");
         browser.First("id").CheckIfTextEquals("data");
     });
 }
Esempio n. 11
0
 public void First()
 {
     RunInAllBrowsers(browser =>
     {
         browser.NavigateToUrl("TemporarySelector.aspx");
         browser.SelectMethod = s => SelectBy.CssSelector(s, "[data-ui='{0}']");
         AssertUI.CheckIfTextEquals(browser.First("p", By.TagName), "p");
         AssertUI.CheckIfTextEquals(browser.First("id", By.Id), "id");
         AssertUI.CheckIfTextEquals(browser.First("id"), "data");
     });
 }
Esempio n. 12
0
        public void ShouldSelectOneEmpty()
        {
            Reflector reflector            = new Reflector();
            Serializer <ItemInput>  input  = reflector.GetSerializer <ItemInput>();;
            Serializer <ItemOutput> output = reflector.GetSerializer <ItemOutput>();;

            Collectible collectible = new Collectible(1024);
            SelectBy    by          = Select.One <ItemInput, ItemOutput>(input, output, x => x.Value.ToString());

            Select.Table(collectible, by);
            Assert.That(collectible.Count, Is.Zero);
        }
 /// <summary>
 /// Selects element by given attribute and value
 /// </summary>
 /// <param name="element">Select element</param>
 /// <param name="by">What way you want to select the option</param>
 /// <param name="value">Value/index of option</param>
 public static void SelectElement(this IWebElement element, SelectBy by, string value)
 {
     if (by == SelectBy.Text)
     {
         new SelectElement(element).SelectByText(value);
     }
     else if (by == SelectBy.Value)
     {
         new SelectElement(element).SelectByValue(value);
     }
     else if (by == SelectBy.Index)
     {
         new SelectElement(element).SelectByIndex(Convert.ToInt32(value));
     }
 }
Esempio n. 14
0
 /// <summary>
 /// Selects element by given attribute and value
 /// </summary>
 /// <param name="element">Select element</param>
 /// <param name="by">What way you want to select the option</param>
 /// <param name="value">Value/index of option</param>
 public static void SelectElement(this IWebElement element, SelectBy by, string value)
 {
     element.WaitTillOptionsPresent();
     if (by == SelectBy.Text)
     {
         new SelectElement(element).SelectByText(value);
     }
     if (by == SelectBy.Value)
     {
         new SelectElement(element).SelectByValue(value);
     }
     if (by == SelectBy.Index)
     {
         new SelectElement(element).SelectByIndex(Convert.ToInt32(value));
     }
 }
Esempio n. 15
0
        public static Collectible Table(Collectible source, SelectBy by)
        {
            Collectible destination = new Collectible(1024 * 1024);

            foreach (dynamic extracted in by.Extract(source))
            {
                foreach (dynamic converted in by.Convert(extracted))
                {
                    by.Enqueue(destination, converted);
                }

                source.Release();
            }

            return(destination);
        }
Esempio n. 16
0
        private static void UploadFileByA(IElementWrapper element, string fullFileName)
        {
            element.BrowserWrapper.GetJavaScriptExecutor()
            .ExecuteScript("dotvvm.fileUpload.createUploadId(arguments[0])", element.WebElement);

            var iframe = element.ParentElement.ParentElement.First("iframe", SelectBy.CssSelector).WebElement;

            element.BrowserWrapper.Driver.SwitchTo().Frame(iframe);

            var fileInput = element.BrowserWrapper._GetInternalWebDriver()
                            .FindElement(SelectBy.CssSelector("input[type=file]"));

            fileInput.SendKeys(fullFileName);

            element.Wait(element.ActionWaitTime);
            element.ActivateScope();
        }
Esempio n. 17
0
        private T getValue(Tank tank, SelectBy by)
        {
            switch (by)
            {
            case SelectBy.Class: return(tank.Class.Pick(ClassLight, ClassMedium, ClassHeavy, ClassDestroyer, ClassArtillery, ClassNone));

            case SelectBy.Country: return(tank.Country.Pick(CountryUSSR, CountryGermany, CountryUSA, CountryFrance, CountryChina, CountryUK, CountryJapan, CountryCzech, CountrySweden, CountryPoland, CountryItaly, CountryNone));

            case SelectBy.Category: return(tank.Category.Pick(CategNormal, CategPremium, CategSpecial, CategCollector));

            case SelectBy.Tier:
                switch (tank.Tier)
                {
                case 0: return(TierNone);

                case 1: return(Tier1);

                case 2: return(Tier2);

                case 3: return(Tier3);

                case 4: return(Tier4);

                case 5: return(Tier5);

                case 6: return(Tier6);

                case 7: return(Tier7);

                case 8: return(Tier8);

                case 9: return(Tier9);

                case 10: return(Tier10);

                default: throw new Exception();
                }

            case SelectBy.Single: return(Single);

            default: throw new Exception();
            }
        }
Esempio n. 18
0
        public static void SelectElementFromDropDown(IWebElement element, SelectBy selectBy, string value)
        {
            SelectElement select = new SelectElement(element);

            switch (selectBy)
            {
            case SelectBy.Index:
                select.SelectByIndex(int.Parse(value));
                break;

            case SelectBy.Text:
                select.SelectByText(value);
                break;

            case SelectBy.Value:
                select.SelectByValue(value);
                break;
            }
        }
Esempio n. 19
0
        public void ShouldSelectOneWithItem()
        {
            Reflector reflector            = new Reflector();
            Serializer <ItemInput>  input  = reflector.GetSerializer <ItemInput>();;
            Serializer <ItemOutput> output = reflector.GetSerializer <ItemOutput>();;

            Collectible collectible = new Collectible(1024);

            collectible.Enqueue(input, new ItemInput {
                Value = 1
            });

            SelectBy by = Select.One(input, output, x => new ItemOutput
            {
                Value = x.Value.ToString()
            });

            collectible = Select.Table(collectible, by);
            Assert.That(collectible.Count, Is.EqualTo(1));
            Assert.That(collectible.At(output, 0).AsDynamic().Value.ToString(), Is.EqualTo("1"));
        }
Esempio n. 20
0
        public void SelectOptionInDropDownBy(SelectBy by, IWebElement dropDownElement, string value)
        {
            var selectElement = new SelectElement(dropDownElement);

            switch (by)
            {
            case SelectBy.Value:
            {
                //select by value
                selectElement.SelectByValue(value);
                break;
            }

            case SelectBy.Text:
            {
                //select by text
                selectElement.SelectByText(value);
                break;
            }
            }
        }
Esempio n. 21
0
        public static By BySelector(SelectBy selectBy, string Selector)
        {
            switch (selectBy)
            {
            case SelectBy.Name:
                selector = By.Name(Selector);
                break;

            case SelectBy.Id:
                selector = By.Id(Selector);
                break;

            case SelectBy.Class:
                selector = By.ClassName(Selector);
                break;

            case SelectBy.CssSelector:
                selector = By.CssSelector(Selector);
                break;
            }
            return(selector);
        }
Esempio n. 22
0
        private Color getColor(Tank tank, SelectBy by)
        {
            switch (by)
            {
            case SelectBy.Class: return(tank.Class.Pick(ClassLight, ClassMedium, ClassHeavy, ClassDestroyer, ClassArtillery, ClassNone));

            case SelectBy.Country: return(tank.Country.Pick(CountryUSSR, CountryGermany, CountryUSA, CountryFrance, CountryChina, CountryUK, CountryJapan, CountryCzech, CountrySweden, CountryPoland, CountryItaly, CountryNone));

            case SelectBy.Category: return(tank.Category.Pick(CategNormal, CategPremium, CategSpecial, CategCollector));

            case SelectBy.Tier:
                if (tank.Tier == 0)
                {
                    return(TierNone);
                }
                return(tank.Tier <= 5 ? Ut.BlendColors(Tier1, Tier5, (tank.Tier - 1) / 4.0) : Ut.BlendColors(Tier5, Tier10, (tank.Tier - 5) / 5.0));

            case SelectBy.Single: return(Single);

            default: throw new Exception();
            }
        }
Esempio n. 23
0
        /// <summary>
        /// Choose an element in IWebElement 'select'. Has 3 ways to select element (value, index, text)
        /// </summary>
        /// <param name="value"></param>
        /// <param name="select"></param>
        /// <param name="by"></param>
        public void ChooseElementInSelect(string value, IWebElement select, SelectBy by)
        {
            SelectElement selector = new SelectElement(select);

            if (by == SelectBy.Text)
            {
                selector.SelectByText(value);
            }

            if (by == SelectBy.Index)
            {
                selector.SelectByIndex(Convert.ToInt32(value));
            }

            if (by == SelectBy.Value)
            {
                selector.SelectByValue(value);
            }
        }
Esempio n. 24
0
 public StaticContent(SelectBy selectBy, string SelectorElement)
 {
     selector = BySelector(selectBy, SelectorElement);
 }
Esempio n. 25
0
 public TextField(SelectBy selectBy, string SelectorElement)
 {
     selector = BySelector(selectBy, SelectorElement);
 }
Esempio n. 26
0
 public By SelectByDataUi(string selector)
 => SelectBy.CssSelector($"[data-ui='{selector}']");
Esempio n. 27
0
        // Get a list of elements from selector and return based on index
        public static AndroidElement GetElementFromList(AndroidDriver <AndroidElement> driver, SelectBy by, string selector, int index)
        {
            AndroidElement e = null;

            switch (by)
            {
            case SelectBy.ID:
                e = driver.FindElementsById(selector)[index];
                break;

            case SelectBy.Class:
                e = driver.FindElementsByClassName(selector)[index];
                break;

            case SelectBy.XPath:
                e = driver.FindElementsByXPath(selector)[index];
                break;

            case SelectBy.ExactText:
                e = driver.FindElementsByAndroidUIAutomator(String.Format("new UiSelector().text(\"{0}\")", selector)).ElementAt(index);
                break;

            case SelectBy.ContainsText:
                e = driver.FindElementsByAndroidUIAutomator(String.Format("new UiSelector().textContains(\"{0}\")", selector)).ElementAt(index);
                break;

            case SelectBy.RegexText:
                e = driver.FindElementsByAndroidUIAutomator(String.Format("new UiSelector().textMatches(\"{0}\")", selector)).ElementAt(index);
                break;
            }
            return(e ?? throw new NotFoundException("Element with selector " + selector + " not found."));
        }
Esempio n. 28
0
 public HtmlSelector(string selectorValue, SelectBy selectBy)
 {
     this.selectorValue = selectorValue;
     this.selectBy      = selectBy;
 }
Esempio n. 29
0
        /// <summary>
        /// Method clicks on date select field of specific column, selects date and searches all records with entered value in this column
        /// </summary>
        public void SearcheRecordsByDateSelectFieldOfSpecificColumnData(string columnNameValue, SelectBy by, string day, string month = currentMonth, string year = currentYear)
        {
            ClickSearchButtonAtTheTopOfTable();
            IWebElement dateSelecterField = commonMethods.GetElementByWithLogs(driver, By.XPath("//thead//tr[contains(@id,'search')]//th[" + GetNumberOfSpecificColumn(columnNameValue) + "]"), "Can NOT find '" + columnNameValue + "' field");

            commonMethods.ScrollToTheElement(dateSelecterField);
            dateSelecterField.Click();
            if (!year.Equals(currentYear))
            {
                datePickerCalendarPlugine.SelectYearInDatePickerCalendar1(by, year);
            }
            if (!month.Equals(currentMonth))
            {
                datePickerCalendarPlugine.SelectMonthInDatePickerCalendar1(by, month);
            }
            datePickerCalendarPlugine.SelectDateByDatePickerCalendar(Int32.Parse(day));
            LogUtil.WriteDebug("Searched all records by selected date " + year + "/" + month + "/" + day + "in '" + columnNameValue + "' field in '" + columnNameValue + "' column");
        }
Esempio n. 30
0
 public Button(SelectBy selectBy, string SelectorElement)
 {
     selector = BySelector(selectBy, SelectorElement);
 }