WaitFor,Ajax和Tester API

Col*_*say 1 casperjs

如果我想使用测试仪API,并使用说assertSelectorExists,我怎么能等待选择器?我知道你可以使用waitForSelector的onTimeout回调并在那里手动创建一条消息,但它似乎打败了能够断言的目的......

NiK*_*iKo 5

像这样的东西?

casper.waitForSelector('#my-selector', function() {
    this.test.pass('selector found');
}, function() {
    this.test.fail('selector was not found');
});
Run Code Online (Sandbox Code Playgroud)