Xpath - How to select an element that contains a text but nothing more
<p>I am trying to select an element that contains a piece of text but I do not want to select the elements that contain the text plus additional text. I would normally use <code>text()='abc def'</code>, but this particular element contains spaces before and after. </p>

<p>Here is an example snippet:</p>

<pre><code>&lt;div&gt; 
     &lt;div&gt;
          abc def
     &lt;/div&gt;
     &lt;div&gt;
          abc def ghi
     &lt;/div&gt;
     &lt;div&gt;
          abc def ghi jkl
     &lt;/div&gt;
&lt;/div&gt;
</code></pre>

<p>I want to select the first div but <code>//div[text()='abc def']</code> does not work because of the leading spaces and <code>//div[contains(text(),'abc def']</code> also does not work because it will select all of the divs.</p>

<p>I have looked into <code>normalize-space</code> and <code>starts-with</code>, but I could not get it to quite work.</p>