1
我想驗證了這樣的代碼通知消息的文本:如何驗證notify.js警報硒
<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>
我的硒代碼:
String notify = BrowserSetup
.driver
.findElement(By.xpath("//span[contains(.,
'Payment Created Successfully')]"))
.getText();
System.out.println(notify);
價值在String notify
是空的。
問題
我怎樣才能得到通知的文字?
參考:notify.js
一次嘗試爲:'BrowserSetup.driver.findElement(By.cssSelector(「div中。 「))。getText();'讓我知道.. :) –
這是拋出沒有這樣的元素例外 –
你能告訴我什麼時候這個警報變成visibl è?? –