public static void SetValueToHtmlElement(HtmlElement element, ElementValueMode mode, string attributeName, string value)
 {
     if (mode == ElementValueMode.Attribute)
     {
         if (!string.IsNullOrEmpty(attributeName))
         {
             string attr = attributeName.ToLower();
             if (attr == "style")
             {
                 element.Style = value;
             }
             else
             {
                 if (attr == "class")
                 {
                     //IE uses className instead of class in its DOM model. Yup I know, it's bullshit.
                     attr = "classname";
                 }
                 element.SetAttribute(attr, value);
             }
         }
     }
     else
     {
         element.InnerText = value;
     }
 }
        public static string GetValueFromHtmlElement(HtmlElement element, ElementValueMode mode, string attributeName)
        {
            string value;

            if (mode == ElementValueMode.Attribute)
            {
                string attr = attributeName != null?attributeName.ToLower() : String.Empty;

                if (attr == "style")
                {
                    value = element.Style != null?element.Style.ToLower() : String.Empty;
                }
                else
                {
                    if (attr == "class")
                    {
                        //IE uses className instead of class in its DOM model. Yup I know, it's bullshit.
                        attr = "classname";
                    }
                    value = element.GetAttribute(attr);
                }
            }
            else
            {
                value = element.InnerText ?? String.Empty;
            }
            return(value);
        }
        public void SetContext(ElementValueMode elementValueMode, ElementIdentifier elementIdentifier, string attributeName)
        {
            cbAttribute.DataSource    = zGetAttributeOptions(elementIdentifier, attributeName);
            cbAttribute.SelectedIndex = 0;

            rbAttribute.Checked = elementValueMode == ElementValueMode.Attribute;
            rbInnerText.Checked = elementValueMode == ElementValueMode.InnerText;
            cbAttribute.Enabled = rbAttribute.Checked;
            if (rbAttribute.Checked && !String.IsNullOrWhiteSpace(attributeName))
            {
                cbAttribute.Text = attributeName;
            }
        }
        public GetValueSuggestor(StepEditContext stepEditContext, ElementIdentifier elementIdentifier, ElementValueMode elementValueMode, string attributeName)
            : this()
        {
            m_StepEditContext = stepEditContext;
            GroupStep parentGroupStep = AutomationUtils.GetParentGroupStep(m_StepEditContext.Sequence, m_StepEditContext.Step);

            if (parentGroupStep != null && parentGroupStep.Iteration != null && parentGroupStep.Iteration is ElementSetIteration)
            {
                m_GroupStepEditContext = new StepEditContext(parentGroupStep, m_StepEditContext.Sequence, m_StepEditContext.StepIndex, m_StepEditContext.StateVariables);
            }
            m_ElementIdentifier = elementIdentifier;
            m_ElementValueMode  = elementValueMode;
            m_AttributeName     = attributeName;
        }
 public ElementAttributeSelector(ElementValueMode elementValueMode, ElementIdentifier elementIdentifier, string attributeName)
     : this()
 {
     SetContext(elementValueMode, elementIdentifier, attributeName);
 }