I have a button, clicking on it generates a number which is wrapped in paragraph text such as <p>
random number <p>
, I want to get that random number value and do operations based on number it generates.
From below I need to get 34,756 number and store it in Java.
Here is the HTML code for it:
<div class="form-group">
<div class="alert alert-count">
<p>
<b>
<!-- react-text: 531 -->
<!-- /react-text -->
<!-- react-text: 532 -->
34,756
<!-- /react-text -->
</b>
And the XPath I used is as below:
String count = driver.findElement(By.xpath("//div[@class='alert alert-count']/p).getText();
But on console it gives error as:
Exception in thread "main" java.lang.NullPointerException