Commit 7069852b 7069852b969b56ba55ac27d69c281a7e4c927477 by Nicolas Perriault

code reorganization

1 parent a6d2a59a
...@@ -1193,6 +1193,22 @@ Casper.prototype.start = function start(location, then) { ...@@ -1193,6 +1193,22 @@ Casper.prototype.start = function start(location, then) {
1193 }; 1193 };
1194 1194
1195 /** 1195 /**
1196 * Returns the current status of current instance
1197 *
1198 * @param Boolean asString Export status object as string
1199 * @return Object
1200 */
1201 Casper.prototype.status = function status(asString) {
1202 var properties = ['currentHTTPStatus', 'defaultWaitTimeout', 'loadInProgress', 'navigationRequested',
1203 'options', 'pendingWait', 'requestUrl', 'started', 'step', 'url'];
1204 var currentStatus = {};
1205 properties.forEach(function(property) {
1206 currentStatus[property] = this[property];
1207 }.bind(this));
1208 return asString === true ? utils.dump(currentStatus) : currentStatus;
1209 };
1210
1211 /**
1196 * Schedules the next step in the navigation process. 1212 * Schedules the next step in the navigation process.
1197 * 1213 *
1198 * @param function step A function to be called as a step 1214 * @param function step A function to be called as a step
...@@ -1313,23 +1329,6 @@ Casper.prototype.toString = function toString() { ...@@ -1313,23 +1329,6 @@ Casper.prototype.toString = function toString() {
1313 }; 1329 };
1314 1330
1315 /** 1331 /**
1316 * Returns the current status of current instance
1317 *
1318 * @param Boolean asString Export status object as string
1319 * @return Object
1320 */
1321 Casper.prototype.status = function status(asString) {
1322 var properties = ['currentHTTPStatus', 'defaultWaitTimeout', 'loadInProgress', 'navigationRequested',
1323 'options', 'pendingWait', 'requestUrl', 'started', 'step', 'url'];
1324 var currentStatus = {};
1325 properties.forEach(function(property) {
1326 console.log(this[property]);
1327 currentStatus[property] = this[property];
1328 }.bind(this));
1329 return asString === true ? utils.dump(currentStatus) : currentStatus;
1330 };
1331
1332 /**
1333 * Sets the user-agent string currently used when requesting urls. 1332 * Sets the user-agent string currently used when requesting urls.
1334 * 1333 *
1335 * @param String userAgent User agent string 1334 * @param String userAgent User agent string
......