javascript - How to verify notify.js alert in selenium -


i want verify text of notification message has code this:

<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 code is:

string notify = browsersetup   .driver   .findelement(by.xpath("//span[contains(.,     'payment created successfully')]"))   .gettext(); system.out.println(notify); 

the value in string notify empty.

question

how can text of notification?

for reference: notify.js

find element css selector

wait.until(expectedconditions.visibilityofelementlocated(by.cssselector(".notifyjs-bootstrap-base.notifyjs-bootstrap-success>span"))).gettext();          string notify= browsersetup.driver.findelement(by.cssselector(".notifyjs-bootstrap-base.notifyjs-bootstrap-success>span")).gettext();         system.out.println(notify); 

it working when find element cssselector


Comments