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); } }
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); } } }