title: how to get value of text wrapped in paragraph element <p> with selenium in java
body: <p>I have a button, clicking on it generates a number which is wrapped in paragraph text such as <code>&lt;p&gt;random number &lt;p&gt;</code>, I want to get that random number value and do operations based on number it generates. From below I need to get <code>34,756</code> number and store it in java here is the html code for it:</p>
  
  <pre><code>&lt;div class="form-group"&gt;
  &lt;div class="alert alert-count"&gt;
    &lt;p&gt;
    &lt;b&gt;
  &lt;!-- react-text: 531 --&gt;
  &lt;!-- /react-text --&gt;
  &lt;!-- react-text: 532 --&gt;
   34,756
  &lt;!-- /react-text --&gt;
  &lt;/b&gt;
  </code></pre>
  
  <p>and the xpath I used is as below</p>
  
  <pre><code>String count = driver.findElement(By.xpath("//div[@class='alert alert-count']/p[1]/b).getText();
  </code></pre>
  
  <p>but on console it gives error as </p>
  
  <blockquote>
    <p>Exception in thread "main" java.lang.NullPointerException</p>
  </blockquote>