/// <summary>
        /// The select made of wrap.
        /// </summary>
        /// <param name="wrapName">
        /// The wrap name. If null, then pick a random one in the list
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool SelectMadeOfWrap(string wrapName = null)
        {
            var wrapToChose = wrapName;
            var selectElem  = WebAdapter.FindElement(By.Id("selConvertSuggestions"));

            if (selectElem == null)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(wrapToChose))
            {
                // Okay no name given - we will pick a random one...
                var options         = selectElem.FindElements(By.XPath("./option"));
                var numberOfOptions = options.Count;

                if (numberOfOptions < 1)
                {
                    return(false);
                }

                var numberToChoose = new Random().Next(2, numberOfOptions);

                wrapToChose = options[numberToChoose].Text.Trim();
            }

            var retVal = WebAdapter.SelectElementSetText(By.Id("selConvertSuggestions"), wrapToChose);

            return(retVal);
        }
Пример #2
0
        /// <summary>
        /// The add model.
        /// </summary>
        /// <param name="modelName">
        /// The model name.
        /// </param>
        /// <param name="pattern">
        /// The pattern.
        /// </param>
        /// <returns>
        /// The <see cref="bool"/>.
        /// </returns>
        public bool AddModel(string modelName, string pattern = null)
        {
            const string AddModelXpath = "//span/span[text()='Add model']";
            var          retVal        = WebAdapter.ButtonClickByXpath(AddModelXpath);

            if (!retVal)
            {
                return(false);
            }

            // if pattern is null, then create model without pattern
            if (string.IsNullOrEmpty(pattern))
            {
                pattern = "--- without pattern ---";
            }

            const string PatternNameXpath = "//p[normalize-space()='Pattern']/../..//select";

            retVal = WebAdapter.SelectElementSetText(By.XPath(PatternNameXpath), pattern);

            if (!retVal)
            {
                return(false);
            }

            const string ModelNameXpath = "//p[normalize-space()='Model']/../..//input";

            retVal = WebAdapter.TextboxSetTextByXpath(ModelNameXpath, modelName);

            if (!retVal)
            {
                return(false);
            }

            retVal = WebAdapter.ButtonClickById("create");

            if (!retVal)
            {
                return(false);
            }

            // Yeap done
            retVal = WebAdapter.ButtonClickById("modelDone");

            return(retVal);
        }
Пример #3
0
        /// <summary>
        /// The add carrier.
        /// </summary>
        /// <typeparam name="T">
        /// The interface for a carrier add
        /// </typeparam>
        /// <returns>
        /// An instance of t
        /// </returns>
        public T AddCarrier <T>()
        {
            WebAdapter.ButtonClickById("but_add_carrier");

            // Give WT time to load the page
            WebAdapter.WaitForComplete(2);

            var selectCarrierType = GetAddCarrierSelectTypeByInterface <T>();

            WebAdapter.SelectElementSetText(By.Id("selTypeCarrier"), selectCarrierType);

            // Selecting the Carrier Type makes the page reload
            WebAdapter.WaitForComplete(2);

            var retVal = Get <T>();

            return(retVal);
        }