Click here to Skip to main content
15,884,473 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<?xml version="1.0"?>
<UITest xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="" Id="b35e9ee2-fbe4-4c42-b667-98350a4b7a05" AssemblyVersion="11.0.50727.1" Version="1.0" xmlns="http://schemas.microsoft.com/VisualStudio/TeamTest/UITest/2010">
  <Configuration>
    <Group Name="IE">
      <Setting Name="Version" Value="8.0.7601.17514" WarningLevel="1" />
      <Setting Name="InformationBar" WarningLevel="1" />
      <Setting Name="AutoCompletePassword" Value="no" WarningLevel="1" />
      <Setting Name="AutoCompleteForm" Value="no" WarningLevel="1" />
      <Setting Name="DefaultBrowser" Value="IEXPLORE.EXE" WarningLevel="1" />
      <Setting Name="PopupBlocker" Value="no" WarningLevel="1" />
      <Setting Name="TabbedBrowsing" Value="1" WarningLevel="2" />
      <Setting Name="InternetZoneSecurity" Value="66816" WarningLevel="2" />
      <Setting Name="IntranetZoneSecurity" Value="69632" WarningLevel="2" />
      <Setting Name="TrustedZoneSecurity" Value="70912" WarningLevel="2" />
      <Setting Name="RestrictedZoneSecurity" Value="73728" WarningLevel="2" />
      <Setting Name="PhishingFilter" WarningLevel="1" />
      <Setting Name="EnhancedSecurityConfiguration" WarningLevel="1" />
    </Group>
    <Group Name="OS">
      <Setting Name="Name" Value="Microsoft Windows 7 Enterprise " WarningLevel="2" />
      <Setting Name="Version" Value="Microsoft Windows NT 6.1.7601 Service Pack 1" WarningLevel="2" />
      <Setting Name="IsUserAdmin" Value="False" WarningLevel="2" />
      <Setting Name="Is64BitOperatingSystem" Value="False" WarningLevel="2" />
      <Setting Name="IsTerminalServerSession" Value="False" WarningLevel="2" />
      <Setting Name="OSLanguage" Value="1033" WarningLevel="1" />
      <Setting Name="UserLocale" Value="1033" WarningLevel="1" />
      <Setting Name="DragFullWindows" Value="True" WarningLevel="2" />
      <Setting Name="ScreenResolutionWidth" Value="1366" WarningLevel="2" />
      <Setting Name="ScreenResolutionHeight" Value="768" WarningLevel="2" />
      <Setting Name="SystemDPIX" Value="96" WarningLevel="2" />
      <Setting Name="SystemDPIY" Value="96" WarningLevel="2" />
      <Setting Name="Aero" Value="1" WarningLevel="1" />
      <Setting Name="UACEnabled" Value="1" WarningLevel="2" />
      <Setting Name="UACPromptEnabled" Value="5" WarningLevel="1" />
    </Group>
    <Group Name="TechnologyManagers">
      <Setting Name="Web" WarningLevel="1" />
      <Setting Name="UIA" WarningLevel="1" />
    </Group>
  </Configuration>
  <InitializeActions />
  <ExecuteActions />
  <CleanupActions />
  <OnErrorActions />
  <Maps>
    <UIMap Id="UIMap">
      <TopLevelWindows>
        <TopLevelWindow ControlType="Window" Id="UIVtigerCRM5CommercialWindow" FriendlyName="vtiger CRM 5 - Commercial Open Source CRM - Window..." SpecialControlType="BrowserWindow" SessionId="2820682">
          <TechnologyName>MSAA</TechnologyName>
          <WindowTitles>
            <WindowTitle>vtiger CRM 5 - Commercial Open Source CRM</WindowTitle>
            <WindowTitle>Administrator - Leads - vtiger CRM 5 - Commercial Open Source CRM - Windows Internet Explorer provided by Dell Client Engineeri</WindowTitle>
          </WindowTitles>
          <SearchConfigurations>
            <SearchConfiguration>VisibleOnly</SearchConfiguration>
          </SearchConfigurations>
          <AndCondition Id="SearchCondition">
            <PropertyCondition Name="Name">vtiger CRM 5 - Commercial Open Source CRM</PropertyCondition>
            <PropertyCondition Name="ClassName">IEFrame</PropertyCondition>
            <PropertyCondition Name="ControlType">Window</PropertyCondition>
          </AndCondition>
          <SupportLevel>1</SupportLevel>
          <Descendants>
            <UIObject ControlType="Document" Id="vTigerLoginPage" FriendlyName="vTigerLoginPage" SpecialControlType="None">
              <TechnologyName>Web</TechnologyName>
              <WindowTitles>
                <WindowTitle>vtiger CRM 5 - Commercial Open Source CRM</WindowTitle>
              </WindowTitles>
              <AndCondition Id="SearchCondition">
                <AndCondition Id="Primary">
                  <PropertyCondition Name="ControlType">Document</PropertyCondition>
                  <PropertyCondition Name="Id" />
                  <PropertyCondition Name="TagName">BODY</PropertyCondition>
                  <PropertyCondition Name="RedirectingPage">False</PropertyCondition>
                  <PropertyCondition Name="FrameDocument">False</PropertyCondition>
                </AndCondition>
                <FilterCondition Id="Secondary">
                  <PropertyCondition Name="Title">vtiger CRM 5 - Commercial Open Source CRM</PropertyCondition>
                  <PropertyCondition Name="AbsolutePath">/index.php</PropertyCondition>
                  <PropertyCondition Name="PageUrl">http://localhost:8888/index.php?action=Login&module=Users</PropertyCondition>
                </FilterCondition>
              </AndCondition>
              <SupportLevel>0</SupportLevel>
              <Descendants>
                <UIObject ControlType="Edit" Id="UserName" FriendlyName="user_name" SpecialControlType="None">
                  <TechnologyName>Web</TechnologyName>
                  <WindowTitles>
                    <WindowTitle>vtiger CRM 5 - Commercial Open Source CRM</WindowTitle>
                  </WindowTitles>
                  <AndCondition Id="SearchCondition">
                    <AndCondition Id="Primary">
                      <PropertyCondition Name="ControlType">Edit</PropertyCondition>
                      <PropertyCondition Name="Id" />
                      <PropertyCondition Name="Name">user_name</PropertyCondition>
                      <PropertyCondition Name="TagName">INPUT</PropertyCondition>
                      <PropertyCondition Name="LabeledBy" />
                      <PropertyCondition Name="Type">SINGLELINE</PropertyCondition>
                    </AndCondition>
                    <FilterCondition Id="Secondary">
                      <PropertyCondition Name="Title" />
                      <PropertyCondition Name="Class" />
                      <PropertyCondition Name="ControlDefinition">name=user_name</PropertyCondition>
                      <PropertyCondition Name="TagInstance">5</PropertyCondition>
                    </FilterCondition>
                  </AndCondition>
                  <SupportLevel>0</SupportLevel>
                  <Descendants />
                </UIObject>
                <UIObject ControlType="Edit" Id="Password" FriendlyName="user_password" SpecialControlType="None">
                  <TechnologyName>Web</TechnologyName>
                  <WindowTitles>
                    <WindowTitle>vtiger CRM 5 - Commercial Open Source CRM</WindowTitle>
                  </WindowTitles>
                  <AndCondition Id="SearchCondition">
                    <AndCondition Id="Primary">
                      <PropertyCondition Name="ControlType">Edit</PropertyCondition>
                      <PropertyCondition Name="Id" />
                      <PropertyCondition Name="Name">user_password</PropertyCondition>
                      <PropertyCondition Name="TagName">INPUT</PropertyCondition>
                      <PropertyCondition Name="LabeledBy" />
                      <PropertyCondition Name="Type">PASSWORD</PropertyCondition>
                    </AndCondition>
                    <FilterCondition Id="Secondary">
                      <PropertyCondition Name="Title" />
                      <PropertyCondition Name="Class" />
                      <PropertyCondition Name="ControlDefinition">value="" type=password name=user_passwor</PropertyCondition>
                      <PropertyCondition Name="TagInstance">6</PropertyCondition>
                    </FilterCondition>
                  </AndCondition>
                  <SupportLevel>0</SupportLevel>
                  <Descendants />
                </UIObject>
                <UIObject ControlType="Button" Id="LoginButton" FriendlyName="Login" SpecialControlType="None">
                  <TechnologyName>Web</TechnologyName>
                  <WindowTitles>
                    <WindowTitle>vtiger CRM 5 - Commercial Open Source CRM</WindowTitle>
                  </WindowTitles>
                  <AndCondition Id="SearchCondition">
                    <AndCondition Id="Primary">
                      <PropertyCondition Name="ControlType">Button</PropertyCondition>
                      <PropertyCondition Name="Id">submitButton</PropertyCondition>
                      <PropertyCondition Name="Name" />
                      <PropertyCondition Name="TagName">INPUT</PropertyCondition>
                      <PropertyCondition Name="DisplayText">Login</PropertyCondition>
                    </AndCondition>
                    <FilterCondition Id="Secondary">
                      <PropertyCondition Name="Type">submit</PropertyCondition>
                      <PropertyCondition Name="Title" />
                      <PropertyCondition Name="Class" />
                      <PropertyCondition Name="ControlDefinition">id=submitButton value=Login type=submit</PropertyCondition>
                      <PropertyCondition Name="TagInstance">7</PropertyCondition>
                    </FilterCondition>
                  </AndCondition>
                  <SupportLevel>0</SupportLevel>
                  <Descendants />
                </UIObject>
              </Descendants>
            </UIObject>
            <UIObject ControlType="Document" Id="vTigerAdministartionPage" FriendlyName="vTiger_Administrator - Leads " SpecialControlType="None">
              <TechnologyName>Web</TechnologyName>
              <WindowTitles>
                <WindowTitle>Administrator - Leads - vtiger CRM 5 - Commercial Open Source CRM - Windows Internet Explorer provided by Dell Client Engineeri</WindowTitle>
              </WindowTitles>
              <AndCondition Id="SearchCondition">
                <AndCondition Id="Primary">
                  <PropertyCondition Name="ControlType">Document</PropertyCondition>
                  <PropertyCondition Name="Id" />
                  <PropertyCondition Name="TagName">BODY</PropertyCondition>
                  <PropertyCondition Name="RedirectingPage">False</PropertyCondition>
                  <PropertyCondition Name="FrameDocument">False</PropertyCondition>
                </AndCondition>
                <FilterCondition Id="Secondary">
                  <PropertyCondition Name="Title">Administrator - Leads - vtiger CRM 5 - Commercial Open Source CRM</PropertyCondition>
                  <PropertyCondition Name="AbsolutePath">/index.php</PropertyCondition>
                  <PropertyCondition Name="PageUrl">http://localhost:8888/index.php?module=Leads&action=EditView&return_action=DetailView&parenttab=Marketing</PropertyCondition>
                </FilterCondition>
              </AndCondition>
              <SupportLevel>0</SupportLevel>
              <Descendants>
                <UIObject ControlType="Edit" Id="UILastnameEdit" FriendlyName="lastname" SpecialControlType="None">
                  <TechnologyName>Web</TechnologyName>
                  <WindowTitles>
                    <WindowTitle>Administrator - Leads - vtiger CRM 5 - Commercial Open Source CRM - Windows Internet Explorer provided by Dell Client Engineeri</WindowTitle>
                  </WindowTitles>
                  <AndCondition Id="SearchCondition">
                    <AndCondition Id="Primary">
                      <PropertyCondition Name="ControlType">Edit</PropertyCondition>
                      <PropertyCondition Name="Id" />
                      <PropertyCondition Name="Name">lastname</PropertyCondition>
                      <PropertyCondition Name="TagName">INPUT</PropertyCondition>
                      <PropertyCondition Name="LabeledBy" />
                      <PropertyCondition Name="Type">SINGLELINE</PropertyCondition>
                    </AndCondition>
                    <FilterCondition Id="Secondary">
                      <PropertyCondition Name="Title" />
                      <PropertyCondition Name="Class">detailedViewTextBox</PropertyCondition>
                      <PropertyCondition Name="ControlDefinition">onblur="this.className='detailedViewText</PropertyCondition>
                      <PropertyCondition Name="TagInstance">24</PropertyCondition>
                    </FilterCondition>
                  </AndCondition>
                  <SupportLevel>0</SupportLevel>
                  <Descendants />
                </UIObject>
              </Descendants>
            </UIObject>
          </Descendants>
        </TopLevelWindow>
      </TopLevelWindows>
    </UIMap>
  </Maps>
  <ValueMap>
    <ParameterList />
  </ValueMap>
</UITest>


I specifcally need the values from
XML
<UIObject ControlType="Document" Id="vTigerLoginPage" FriendlyName="vTigerLoginPage" SpecialControlType="None">


and
XML
<UIObject ControlType="Document" Id="vTigerAdministartionPage" FriendlyName="vTiger_Administrator - Leads " SpecialControlType="None">

Only the Id values from these two statements how do i get through C# code
Posted
Updated 12-Mar-14 8:52am
v2
Comments
Vedat Ozan Oner 4-Mar-14 8:26am    
what have you tried?
ShaHam11 5-Mar-14 1:47am    
Hi Vedat

XmlNodeList r = doc.GetElementsByTagName("UITest");
XmlNodeList l = r[0].ChildNodes;

DataSet ds = new DataSet();
DataView dv;
ds.ReadXml(strXMLFileName);
dv = new DataView(ds.Tables[0]);
int index = dv.Find("Document");
ShaHam11 5-Mar-14 1:49am    
the childnodes has Configuration,
<initializeactions>
<executeactions>
<cleanupactions>

1 solution

First of all, check your XML for errors. It can be a copy-paste or site rendering issue, but the displayed document has a few errors in the values representing URLs and containing '&'. Ampersand is a special character and must be encoded as &amp;.

If you want to use XmlDocument, you can try XPath to quickly find the desired element. In this case you have to use a namespace manager, for your elements belong to a non-empty namespace. Below is one of the valid solutions:
C#
XmlDocument doc = new XmlDocument();
//load your doc
XmlNamespaceManager xnm = new XmlNamespaceManager(doc.NameTable);
xnm.AddNamespace("m", "http://schemas.microsoft.com/VisualStudio/TeamTest/UITest/2010");
XmlElement el = (XmlElement) doc.SelectSingleNode("//m:UIObject[@Id='vTigerLoginPage']", xnm);

Although XmlDocument is the most popular option, I don't recommend to use it if you only need to read from a document. The better option would be to use XPathDocument or XDocument (in later versions of .NET).
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900