private string zGetRelativeSelectorPathForXSLT(ElementIdentifier baseIdentifier, ElementIdentifier targetIdentifier)
        {
            string selectPath = String.Empty;

            if (targetIdentifier != null)
            {
                if (baseIdentifier != null)
                {
                    targetIdentifier = targetIdentifier.RelativeTo(baseIdentifier);
                }
                if (targetIdentifier.PrimaryIdentifier != null)
                {
                    selectPath = targetIdentifier.PrimaryIdentifier.Replace('"', '\'');

                    //Strip out tbody tags from path... they are not supported in the XML transformation of the DOM.
                    selectPath = Regex.Replace(selectPath, "/?/?tbody[^/]*", String.Empty, RegexOptions.IgnoreCase);

                    if (baseIdentifier != null && selectPath.StartsWith("/"))
                    {
                        selectPath = selectPath.Remove(0, 1);
                    }
                }
            }
            return(selectPath);
        }
Esempio n. 2
0
        private void btnRelative_Click(object sender, EventArgs e)
        {
            ElementIdentifier baseElement   = (ElementIdentifier)olvElementIdentifiers.SelectedObjects[0];
            ElementIdentifier targetElement = (ElementIdentifier)olvElementIdentifiers.SelectedObjects[1];
            ElementIdentifier relative      = targetElement.RelativeTo(baseElement);

            m_ElementIdentifiers.Add(relative);
            zRefreshList();
        }
Esempio n. 3
0
 private void zDetect(ElementIdentifier containerIdentifier)
 {
     if (containerIdentifier != null)
     {
         m_BrowserHelper.PollElements(containerIdentifier, (containerElements) =>
         {
             foreach (HtmlElement containerElement in containerElements)
             {
                 ElementIdentifier relativeIdentifier = m_ElementIdentifier.RelativeTo(containerIdentifier);
                 HtmlElement stepElement = m_BrowserHelper.FindElement(relativeIdentifier, containerElement);
                 if (stepElement != null)
                 {
                     string value = AutomationUtils.GetValueFromHtmlElement(stepElement, m_ElementValueMode, m_AttributeName);
                     if (!String.IsNullOrEmpty(value))
                     {
                         value = value.Trim();
                         if (!m_Results.Contains(value))
                         {
                             m_Results.Add(value);
                         }
                     }
                 }
             }
             zShow();
         });
     }
     else
     {
         m_BrowserHelper.PollElement(m_ElementIdentifier, (getValueElement) =>
         {
             string value = AutomationUtils.GetValueFromHtmlElement(getValueElement, m_ElementValueMode, m_AttributeName);
             if (!String.IsNullOrEmpty(value))
             {
                 value = value.Trim();
                 m_Results.Add(value);
             }
             zShow();
         });
     }
 }