コード例 #1
0
        private ResultElement ReadWebElementProperties(IWebElement el)
        {
            MyLog.Write("ReadWebElementProperties - Entered");

            ResultElement displayItem = new ResultElement();

            string tagName     = el.TagName;
            string elementId   = el.GetAttribute("id") ?? "n/a";
            string elementName = el.GetAttribute("name") ?? "n/a";

            if (tagName == "input")
            {
                var elementType  = el.GetAttribute("type") ?? "n/a";
                var elementValue = el.GetAttribute("value") ?? "n/a";
                displayItem.DisplayString = String.Format("{0}[type=\'{4}\'] id=\"{1}\"; name=\"{2}\"; value=\"{3}\"", el.TagName, elementId, elementName, elementValue, elementType);
            }
            else
            {
                string elementText = el.Text ?? "n/a";
                displayItem.DisplayString = String.Format("{0} id=\"{1}\"; name=\"{2}\"; text(\"{3}\")", el.TagName, elementId, elementName, elementText);
            }

            displayItem.WebElement = el;
            MyLog.Write("ReadWebElementProperties - Exited");
            return(displayItem);
        }
コード例 #2
0
        internal void ShowElementInTree(ResultElement element)
        {
            IWebElement webElement = element.WebElement;
            string      xPath      = SwdBrowser.GetElementXPath(webElement);

            var travelNodes = GetTreeTravelDataFromXPath(xPath);

            FindTreeNode(travelNodes);
        }
コード例 #3
0
        internal void TestLocators()
        {
            var searchMethod = Presenters.SelectorsEditPresenter.GetLocatorSearchMethod();
            var locator      = Presenters.SelectorsEditPresenter.GetLocatorText();

            Stopwatch sw = new Stopwatch();

            sw.Start();
            var elements = FindElements(searchMethod, locator);

            sw.Stop();


            Presenters.PageObjectDefinitionPresenter.UpdateLastCallStat(sw.ElapsedMilliseconds.ToString() + " ms");

            List <ResultElement> displayList = new List <ResultElement>();

            foreach (var el in elements)
            {
                ResultElement displayItem = new ResultElement();

                string tagName     = el.TagName;
                string elementId   = el.GetAttribute("id") ?? "n/a";
                string elementName = el.GetAttribute("name") ?? "n/a";

                if (tagName == "input")
                {
                    var elementType  = el.GetAttribute("type") ?? "n/a";
                    var elementValue = el.GetAttribute("value") ?? "n/a";
                    displayItem.DisplayString = String.Format("{0}[type=\'{4}\'] id=\"{1}\"; name=\"{2}\"; value=\"{3}\"", el.TagName, elementId, elementName, elementValue, elementType);
                }
                else
                {
                    string elementText = el.Text ?? "n/a";
                    displayItem.DisplayString = String.Format("{0} id=\"{1}\"; name=\"{2}\"; text(\"{3}\")", el.TagName, elementId, elementName, elementText);
                }

                displayItem.WebElement = el;
                displayList.Add(displayItem);
            }

            view.DisplaySearchResults(displayList);
        }