コード例 #1
0
ファイル: Brand.cs プロジェクト: UlrichFreiberg/WrapTrack.Stf
        /// <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);
        }