nightwatchjs --Expect element to not include text

to have NightWatch to find text in a div.

browser.assert.containsText('#output', 'find me') 

But how do I tell NightWatch to expect not to find text in an element?

browser.expect.element('#output').text.to.not.equal('Do not find me');

 

.before(ms) / .after(ms)

在指定时间前或者后重新执行断言,其后可串接其他判断,增加重试的机会

示例:检视 .rt-flagship .rt-ad-heading 这个 DOM element 的 inner text是否为「露天旗舰店」、是否包含「露天」,並在 0.5 秒后重新检视一次。

browser.expect.element('.rt-flagship .rt-ad-heading').text.to.equal('露天旗舰店').text.to.contain('露天').before(500);
browser.expect.element('.rt-flagship .rt-ad-heading').text.to.equal('露天旗艦店').after(1000).text.to.contain('露天'); 

browser.end();

  

posted on 2018-01-31 13:57  清明-心若淡定  阅读(183)  评论(0编辑  收藏  举报