title: How to get text from parent element and exclude text from children (C# Selenium)
body: <p>Is it possible to get the text only from a parent element and not its children in Selenium?</p>
  
  <p>Example:
  Suppose I have the following code:</p>
  
  <pre><code>&lt;div class="linksSection&gt;
    &lt;a href="https://www.google.com/" id="google"&gt;Google Link
      &lt;span class="helpText"&gt;This link will take you to Google's home page.&lt;/span&gt;
    &lt;/a&gt;
    ...
  &lt;/div&gt;
  </code></pre>
  
  <p>In C# (or whatever language), I will have:</p>
  
  <pre><code>string linktext = driver.FindElement(By.CssSelector(".linksSection &gt; a#google")).Text;
  Assert.AreEqual(linkText, "Google Link", "Google Link fails text test.");
  </code></pre>
  
  <p>However, the linktext will have "Google LinkThis link will take you to Google's home page."</p>
  
  <p>Without doing a bunch of string manipulation (such as getting the text of all the children and subtracting that from resultant text of the parent), is there a way to get just the text from a parent element?</p>