title: XPath: How to select elements based on their value?
body: <p>I am new to using XPath and this may be a basic question. Kindly bear with me and help me in resolving the issue. I have an XML file like this:</p>
  
  <pre><code>&lt;RootNode&gt;
    &lt;FirstChild&gt;
      &lt;Element attribute1="abc" attribute2="xyz"&gt;Data&lt;/Element&gt;
    &lt;FirstChild&gt;
  &lt;/RootNode&gt;
  </code></pre>
  
  <p>I can validate the presence of an <code>&lt;Element&gt;</code> tag with:</p>
  
  <pre>//Element[@attribute1="abc" and @attribute2="xyz"]</pre>
  
  <p>Now I also want to check the value of the tag for string <code>"Data"</code>. For achieving this I was told to use:</p>
  
  <pre>//Element[@attribute1="abc" and @attribute2="xyz" and Data]</pre>
  
  <p>When I use the later expression I get the following error:</p>
  
  <blockquote>
    <p>Assertion failure message: No Nodes Matched <code>//Element[@attribute1="abc" and @attribute2="xyz" and Data]</code></p>
  </blockquote>
  
  <p>Kindly provide me with your advice whether the XPath expression I have used is valid. If not what will be the valid XPath expression?</p>