示例#1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (m_Selector.SelectedElements.Count > 0)
     {
         foreach (HtmlElement element in m_Selector.SelectedElements)
         {
             ElementIdentifier elementIdentifier = ElementIdentifier.FromHtmlElement(element);
             m_ElementIdentifiers.Add(elementIdentifier);
         }
         m_Selector.ClearSelection();
         zRefreshList();
     }
     else
     {
         ElementIdentifier elementIdentifier = new ElementIdentifier();
         using (frmElementIdentifierEditor frm = new frmElementIdentifierEditor(elementIdentifier))
         {
             if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 m_ElementIdentifiers.Add(elementIdentifier);
                 zRefreshList();
             }
         }
     }
 }
示例#2
0
 void m_Selector_ElementHighlighted(object sender, ElementSelectorEventArgs e)
 {
     if (e.FromUserAction)
     {
         ElementIdentifier identifier = ElementIdentifier.FromHtmlElement(e.Element);
         gbBrowser.Text = identifier.PrimaryIdentifier;
     }
 }
示例#3
0
 void m_ContainerSelector_ElementSelected(object sender, ElementSelectorEventArgs e)
 {
     if (e.FromUserAction)
     {
         m_ContainerIdentifier = ElementIdentifier.FromHtmlElement(e.Element).RemoveSelector();
         zElementSelected();
         zPreview();
     }
 }
示例#4
0
        void element_OnChange(object sender, EventArgs e)
        {
            HtmlElement activeElement = wbRecorder.Document.ActiveElement;

            if (activeElement != null)
            {
                SetValueStep setValueStep = new SetValueStep()
                {
                    Element       = ElementIdentifier.FromHtmlElement(activeElement),
                    Mode          = ElementValueMode.Attribute,
                    AttributeName = "value",
                    Value         = activeElement.GetAttribute("value")
                };
                zAddStep(setValueStep);
            }
        }
示例#5
0
 void Document_MouseUp(object sender, HtmlElementEventArgs e)
 {
     if (!m_ElementSelector.IsActive)
     {
         HtmlElement element = wbRecorder.Document.GetElementFromPoint(e.ClientMousePosition);
         if (element != null)
         {
             ClickStep clickStep = new ClickStep()
             {
                 ClickType = ClickType.Left,
                 Element   = ElementIdentifier.FromHtmlElement(element)
             };
             zAddStep(clickStep);
         }
     }
 }
示例#6
0
 void m_ElementSelector_ElementSelected(object sender, ElementSelectorEventArgs e)
 {
     if (e.FromUserAction)
     {
         //TODO: refactor this so that code is not repeated.
         if (m_ElementSelectMode == ElementSelectMode.Get)
         {
             GetValueStep getValueStep = new GetValueStep()
             {
                 StateVariable      = zGenerateVariableName(),
                 Element            = ElementIdentifier.FromHtmlElement(e.Element),
                 XMLFieldOutputMode = XMLFieldOutputMode.Attribute,
                 PersistenceMode    = PersistenceMode.None
             };
             //Default mode & attribute based on tag type
             if (e.Element.TagName.ToLower() == "input")
             {
                 getValueStep.Mode          = ElementValueMode.Attribute;
                 getValueStep.AttributeName = "value";
             }
             else
             {
                 getValueStep.Mode = ElementValueMode.InnerText;
             }
             zAddStep(getValueStep);
         }
         else
         {
             SetValueStep setValueStep = new SetValueStep()
             {
                 Element = ElementIdentifier.FromHtmlElement(e.Element)
             };
             //Default mode & attribute based on tag type
             if (e.Element.TagName.ToLower() == "input")
             {
                 setValueStep.Mode          = ElementValueMode.Attribute;
                 setValueStep.AttributeName = "value";
             }
             else
             {
                 setValueStep.Mode = ElementValueMode.InnerText;
             }
             zAddStep(setValueStep);
         }
     }
 }