internal void HighLightElementFromNode(TreeNode treeNode)
        {
            string xpath = GetXPathFromTreeNode(treeNode);
            var    by    = SwdBrowser.ConvertLocatorSearchMethodToBy(LocatorSearchMethod.XPath, xpath);

            SwdBrowser.HighlightElement(by);
        }
Esempio n. 2
0
        internal void HighLightWebElement(WebElementDefinition element)
        {
            if (!IsValidForm())
            {
                return;
            }

            var by = SwdBrowser.ConvertLocatorSearchMethodToBy(element.HowToSearch, element.Locator);

            SwdBrowser.HighlightElement(by);
        }
Esempio n. 3
0
        public void UpdateWebElementWithAdditionalProperties(WebElementDefinition element)
        {
            var by         = SwdBrowser.ConvertLocatorSearchMethodToBy(element.HowToSearch, element.Locator);
            var attributes = new Dictionary <string, string>();

            try
            {
                attributes = SwdBrowser.ReadElementAttributes(by);
            }
            catch (Exception e)
            {
                string errorMsg = string.Format(
                    "UpdateWebElementWithAdditionalProperties:\n" +
                    "Failed to find element: How={0};   Locator={1}\n" +
                    "With exception:\n {2}"
                    , element.HowToSearch.ToString()
                    , element.Locator.ToString()
                    , e.Message

                    );
                MyLog.Error(errorMsg);
            }


            if (attributes.Count == 0)
            {
                return;
            }

            element.HtmlTag = attributes["TagName"];
            attributes.Remove("TagName");

            WebElementHtmlAttributes elementAttrs = new WebElementHtmlAttributes();

            foreach (var attrKey in attributes.Keys)
            {
                elementAttrs.Add(attrKey, attributes[attrKey]);
            }

            element.AllHtmlTagProperties = elementAttrs;
        }
Esempio n. 4
0
        internal void HighLightWebElement(WebElementDefinition element)
        {
            var by = SwdBrowser.ConvertLocatorSearchMethodToBy(element.HowToSearch, element.Locator);

            SwdBrowser.HighlightElement(by);
        }
        public ReadOnlyCollection <IWebElement> FindElements(LocatorSearchMethod searchMethod, string locator)
        {
            var by = SwdBrowser.ConvertLocatorSearchMethodToBy(searchMethod, locator);

            return(Driver.FindElements(by));
        }