【发布时间】:2015-07-15 01:50:33
【问题描述】:
我有一个关于诗乃测试的问题。我正在使用mochacasper,我想捕获单击按钮后发送的 XMLHttpRequest。到目前为止,我无法收到请求...
casper.then(function () {
this.fill(...);
});
casper.then(function() {
this.click('#myButton');
});
casper.then(function () {
//I want to catch the request/response here
});
由于我使用的是我的测试环境数据库,我知道我的请求已发送,因为我的测试数据已添加到我的数据库中。
我试过sinon's useFakeXMLHttpRequest 和sinon's fakeServer,但都没有工作。
那么我怎样才能捕捉到请求呢?
【问题讨论】:
-
不是SinonJS,而是自己的创作。也许它适用于您的用例:How can I catch and process the data from the XHR responses using casperjs?
标签: javascript jquery mocha.js casperjs sinon