private static void recordChangeEvent(object sender, EventArgs e)
 {
     if (isRunning())
     {
         IHTMLElement changeElement = Util.getElement(sender);
         if (changeElement.tagName.ToLower() == "select")
         {
             recordSelectEvent(changeElement);
         }
         else if (changeElement.tagName.ToLower() == "textarea" ||
                  (Util.isAttributePresent(changeElement, "type") &&
                   Events.isInputType(Util.getAttribute(changeElement, "type"))))
         {
             String input = Util.getAttribute(changeElement, "value");
             if (!String.IsNullOrEmpty(input))
             {
                 if (Util.getAttribute(changeElement, "type").ToLower().Equals("password"))
                 {
                     CognizantITS.sendRecordedObject(changeElement, "setEncrypted", "@" + input);
                 }
                 else
                 {
                     CognizantITS.sendRecordedObject(changeElement, "Set", "@" + input);
                 }
             }
             else
             {
                 CognizantITS.sendRecordedObject(changeElement, "clear");
             }
         }
     }
 }
コード例 #2
0
 private static void highlightOnMouseOver(object sender, EventArgs e)
 {
     if (isRunning())
     {
         IHTMLElement element = Util.getElement(sender);
         Util.highlightElement(element);
         CognizantITS.sendSpiedObject(element);
     }
 }
コード例 #3
0
        private static void searchElement(HObject x, DispHTMLDocument doc)
        {
            String  exist  = "false";
            Element result = findElement(x.prop, doc);

            if (result != null && result.element != null)
            {
                exist = result.count > 1 ? "partial" : "true";
                highlightElements(result.element);
            }
            CognizantITS.sendHealResult(x.pageName, x.objectname, exist);
        }
        private static void unorderedListClickListener(IHTMLElement clickElement)
        {
            var value = clickElement.innerText.Trim();

            if (value.Length > 0)
            {
                CognizantITS.sendRecordedObject(clickElement.parentElement, "selectValueFromUnorderedList", "@" + value);
            }
            else
            {
                CognizantITS.sendRecordedObject(clickElement.parentElement, "selectIndexFromUnorderedList", "@" + Util.getElementCount(clickElement));
            }
        }
        private static void recordSelectEvent(IHTMLElement element)
        {
            IHTMLSelectElement selectelement = element as IHTMLSelectElement;
            IHTMLElement       selement      = selectelement.item(selectelement.selectedIndex) as IHTMLElement;
            String             value         = selement.innerText;

            if (!String.IsNullOrEmpty(value))
            {
                CognizantITS.sendRecordedObject(element, "selectByVisibleText", "@" + value);
            }
            else
            {
                CognizantITS.sendRecordedObject(element, "selectByIndex", "@" + selectelement.selectedIndex);
            }
        }
        internal static void contextClick(String menuItem)
        {
            if (menuItem.Contains("Text"))
            {
                CognizantITS.sendRecordedObject(contextElement, menuItem, "@" + CognizantITSObject.getTextORValue(contextElement));
            }
            else if (menuItem.Contains("Title"))
            {
                CognizantITS.sendRecordedObject(menuItem, "@" + Helper.getHelper().getTitle());
            }
            else if (menuItem.Contains("Url"))
            {
                CognizantITS.sendRecordedObject(menuItem, "@" + Helper.getHelper().getURL());
            }
            else if (menuItem.ToLower().Equals("open"))
            {
                CognizantITS.sendRecordedObject("Open", "@" + Helper.getHelper().getURL());
            }
            else if (menuItem.Equals("capturePageTimings"))
            {
                CognizantITS.sendRecordedObject(menuItem, "@" + Helper.getHelper().getTitle().Split(' ')[0]);
            }
            else if (menuItem.Contains("add"))
            {
                switch (menuItem)
                {
                case "addElementWithInput":
                    CognizantITS.sendRecordedObject(contextElement, null, "@" + CognizantITSObject.getTextORValue(contextElement));
                    break;

                case "addElement":
                    CognizantITS.sendRecordedObject(contextElement, null);
                    break;

                case "addBrowserWithInput":
                    CognizantITS.sendRecordedObject("", "@" + CognizantITSObject.getTextORValue(contextElement));
                    break;
                }
            }
            else if (menuItem.Contains("Element"))
            {
                CognizantITS.sendRecordedObject(contextElement, menuItem);
            }
            else
            {
                CognizantITS.sendRecordedObject(menuItem);
            }
        }
コード例 #7
0
 private static void recordContextEvent(object sender, EventArgs e)
 {
     if (isRunning())
     {
         IHTMLEventObj eventObj = Util.getEvent(sender);
         if (eventObj.ctrlKey)
         {
             IHTMLElement currContextElement = eventObj.srcElement;
             Util.setFrame(currContextElement, sender);
             if ((contextElement != null && !contextElement.Equals(currContextElement)) || contextElement == null)
             {
                 CognizantITS.sendSpiedObjectToSave(currContextElement);
             }
             contextElement       = currContextElement;
             eventObj.returnValue = false;
         }
     }
 }
 private static void recordClickEvent(object sender, EventArgs e)
 {
     if (isRunning())
     {
         IHTMLElement clickElement = Util.getElement(sender);
         if (findClickableElement(clickElement) != null)
         {
             CognizantITS.sendRecordedObject(clickElement, "Click");
         }
         else if (clickElement.tagName.ToLower() == "li")
         {
             unorderedListClickListener(clickElement);
         }
         else if (clickElement.tagName.ToLower() != "select")
         {
             // checkForMutatation(clickElement);
         }
     }
 }
 private static void onBlurEvent(object sender, EventArgs e)
 {
     if (isRunning())
     {
         IHTMLElement element = Util.getElement(sender);
         if (isInputTypeText(element))
         {
             String pvalue = Util.getAttribute(element, "previousValue");
             String value  = Util.getAttribute(element, "value");
             if (value != null && (pvalue == null || !pvalue.Equals(value)))
             {
                 if (Util.getAttribute(element, "type").ToLower().Equals("password"))
                 {
                     CognizantITS.sendRecordedObject(element, "setEncrypted", "@" + value);
                 }
                 else
                 {
                     CognizantITS.sendRecordedObject(element, "Set", "@" + value);
                 }
             }
         }
     }
 }