title: How to retrieve [object Text] via XPath?
body: <p>I am working on selenium and trying to access text from a node but I'm not sure how to fetch and assert a text that has keyword approved.</p>
  
  <p>This is the node - </p>
  
  <pre><code>&lt;div class="Notification-body"&gt;
      &lt;div class=""&gt;
          &lt;div class="type--primary u-textBreak"&gt;
              &lt;span class="u-inline"&gt;
                  &lt;span class="type--title"&gt;User Name&lt;/span&gt; approved "Page_For_Submission"
              &lt;/span&gt;
          &lt;/div&gt;
          &lt;span class="u-displayBlock type--note"&gt;4 hours ago&lt;/span&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>Initially I tried this XPath but it is giving no result - </p>
  
  <pre><code>(//span[contains(@class,'title')]/following-sibling::text()[contains(text(),'approved')])[1]
  </code></pre>
  
  <p>means this is not a simple text node.</p>
  
  <p>Later I used following XPaths and able to locate position of the element </p>
  
  <pre><code>(//html/body/div[7]/div[3]/div[2]/div/div/div/div/ul/li[2]/a/div/div/div/div/span/text())[2]
  </code></pre>
  
  <pre><code>//span[contains(@class,'title')]/following-sibling::text()
  </code></pre>
  
  <pre><code>(//span[contains(@class,'title')]/following-sibling::text()[contains(.,'approved')])[1]
  </code></pre>
  
  <p>But by using these XPaths in selenium </p>
  
  <pre><code>System.out.println(driver.findElement(By.xpath(prop.getProperty("txt_approvedNotification"))).getText());
  </code></pre>
  
  <p>Getting following error while executing</p>
  
  <pre><code>org.openqa.selenium.InvalidSelectorException: invalid selector: The result of the xpath expression "(XPath of Element)[2]" is: [object Text]. It should be an element.
    (Session info: chrome=77.0.3865.90)
  Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:26:55.152Z'
  System info: host: '*****', ip: '*****', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0', java.version: '1.8.0_191'
  
  Driver info: org.openqa.selenium.chrome.ChromeDriver
  Capabilities {acceptInsecureCerts: false, browserName: chrome, browserVersion: 77.0.3865.90,
  </code></pre>
  
  <p>Just want to know if its XPath issue or seleniumdriver limitation.</p>