I am trying to validate the text of a notification message with the following code structure:
<div class="notifyjs-corner" style="top: 0px; left: 45%;">
<div class="notifyjs-wrapper notifyjs-hidable">
<div class="notifyjs-arrow" style=""/>
<div class="notifyjs-container" style="">
<div class="notifyjs-bootstrap-base notifyjs-bootstrap-success">
<span data-notify-text="">Payment Created Successfully</span>
</div>
</div>
</div>
</div>
My selenium script looks like this:
String notify = BrowserSetup
.driver
.findElement(By.xpath("//span[contains(.,
'Payment Created Successfully')]"))
.getText();
System.out.println(notify);
The variable String notify
is currently returning an empty value.
Query
How can I extract the text from the notification?
For more information: notify.js