Пример #1
0
        public void SetupAttributes(Tuple <XModule, XModuleAttribute, bool> modulePack, IHTMLElement link)
        {
            var checkValidLink = link.getAttribute("href");

            if (checkValidLink.Contains("javascript()") || link.innerText == null || checkValidLink == "")
            {
                return;
            }

            var rgx       = new Regex("\n");
            var innerText = rgx.Replace(link.innerText, "").Trim();

            if (innerText == "")
            {
                return;
            }


            var attribute = modulePack.Item3 ? modulePack.Item1.CreateModuleAttribute() : modulePack.Item2.CreateModuleAttribute();

            attribute.DefaultActionMode = XTestStepActionMode.Input;
            attribute.Name = innerText;

            attribute.BusinessType = "Link";
            AddBusinessParam(attribute.CreateConfigurationParam(), "Engine", "Html");
            AddBusinessParam(attribute.CreateConfigurationParam(), "BusinessAssociation", "Descendants");

            foreach (var technical in Scrapper.DecideForTechnicals(link))
            {
                AddBusinessParam(attribute.CreateTechnicalIDParam(), technical.Key, technical.Value);
            }

            AddBusinessParam(attribute.CreateTechnicalIDParam(), "InnerText", innerText);
        }
Пример #2
0
        public void SetupAttributes(Tuple <XModule, XModuleAttribute, bool> modulePack, IHTMLElement hidden)
        {
            var attribute = modulePack.Item3 ? modulePack.Item1.CreateModuleAttribute() : modulePack.Item2.CreateModuleAttribute();
            var attrName  = hidden.getAttribute("value") ?? hidden.getAttribute("name");

            attribute.Name              = attrName;
            attribute.Cardinality       = "0-1";
            attribute.BusinessType      = "Hidden";
            attribute.DefaultActionMode = XTestStepActionMode.Input;

            AddBusinessParam(attribute.CreateConfigurationParam(), "Engine", "Html");
            AddBusinessParam(attribute.CreateConfigurationParam(), "BusinessAssociation", "Descendants");

            foreach (var technical in Scrapper.DecideForTechnicals(hidden))
            {
                AddBusinessParam(attribute.CreateTechnicalIDParam(), technical.Key, technical.Value);
            }
        }