コード例 #1
0
        public void SelectFeatureKeyword(string keyword)
        {
            var itemToCheck = KeywordsList.FirstOrDefault(item => item.Text.Contains(keyword));

            _driver.ScrollIntoCenterViaJS(itemToCheck);
            ((IJavaScriptExecutor)_driver)
            .ExecuteScript($"document.querySelector('[aria-label=\"{keyword}\"] span span').click()");
        }
コード例 #2
0
ファイル: DevicesParser.cs プロジェクト: ZiCold/NumeneraMate
        /// <summary>
        /// Creates single cypher or artefact
        /// </summary>
        /// <param name="lines"></param>
        /// <param name="currentIndex"></param>
        /// <param name="curObj"></param>
        /// <returns></returns>
        private int BuildCurrentDevice(string[] lines, int currentIndex, out Dictionary <string, string> curObj)
        {
            curObj = new Dictionary <string, string>();
            curObj.Add(NameKeyword, UppercaseFirstLetters(lines[currentIndex]));

            // read current object body starting from the next string
            var    currentKeyword = "";
            int    j;
            string tableKeyword = KeywordsList.FirstOrDefault(x => x.StartsWith("#"));
            bool   isThereTable = string.IsNullOrEmpty(tableKeyword) ? false : true;

            for (j = currentIndex + 1; j < lines.Length; j++)
            {
                if (string.IsNullOrEmpty(lines[j]))
                {
                    continue;
                }
                // either end of the array or start of the new object
                if (j + 1 != lines.Length && lines[j + 1].StartsWith(KeywordsList.First()))
                {
                    return(j - 1);
                }

                // check line for Keyword and add new line
                foreach (var keyword in KeywordsList)
                {
                    if (keyword == tableKeyword && lines[j].StartsWith(keyword.Substring(1)))
                    {
                        currentKeyword = keyword;
                        break;
                    }
                    if (lines[j].StartsWith(keyword))
                    {
                        currentKeyword = keyword;
                        break;
                    }
                }

                if (currentKeyword == "")
                {
                    curObj[NameKeyword] += " " + lines[j];
                    continue;
                }

                if (currentKeyword == tableKeyword)
                {
                    curObj.Add(currentKeyword, "");
                    j = BuildTable(lines, j, out var tableLine);
                    curObj[currentKeyword] = tableLine;
                    continue;
                }

                if (curObj.ContainsKey(currentKeyword))
                {
                    curObj[currentKeyword] += " " + lines[j];
                }
                else
                {
                    var startOfDescription = lines[j].Substring(currentKeyword.Length);
                    curObj.Add(currentKeyword, startOfDescription);
                }
            }
            return(j);
        }