我在HTML页面中有一个<label id=ajaxtest>Not ajax</label>。5秒后,标签被更改为<label id=ajaxtest>Called ajax</label>
我正在使用夜报,并试图断言文本是否即将出现“调用ajax”。我对夜猫子很陌生,还有点卡住了,我可以走了。我尝试了几个使用异步函数和标签getText的步骤,但是似乎没有什么是可行的。
'Should display "Called ajax" message': (client) => {
home
.waitForElementVisible('@ajaxlabel',1000)
.assert.containsText('@ajaxlabel', 'not ajax');
client
.executeAsync(function(done) {
(function fn(){
// tried getText() here but the code is not working..
return done("Finally");
})();
}, [], function(result) {
console.log("Inside Final:"+result.value);
});发布于 2018-03-20 13:20:30
您可能可以使用前/后方法来完成这一任务。
home.expect.element('@ajaxlabel').text.to.contain('Called ajax').after(5000);https://stackoverflow.com/questions/49376179
复制相似问题