Commit 2a74e14c 2a74e14c45a6bbc07837d5d5e38878684f1d2fb1 by Nicolas Perriault

Merge pull request #216 from chiefcll/feature-client-scope

Change clientutils to be able to set a global scope
2 parents 99a4f6bf d6c11e45
......@@ -456,7 +456,7 @@ Casper.prototype.die = function die(message, status) {
*/
Casper.prototype.download = function download(url, targetPath, method, data) {
"use strict";
var cu = require('clientutils').create(this.options);
var cu = require('clientutils').create(utils.mergeObjects({}, this.options));
try {
fs.write(targetPath, cu.decode(this.base64encode(url, method, data)), 'wb');
this.emit('downloaded.file', targetPath);
......
......@@ -57,7 +57,7 @@
// public members
this.options = options || {};
this.options.scope = this.options.scope || document;
/**
* Clicks on the DOM element behind the provided selector.
*
......@@ -243,7 +243,7 @@
* @return NodeList|undefined
*/
this.findAll = function findAll(selector, scope) {
scope = scope || document;
scope = scope || this.options.scope;
try {
var pSelector = this.processSelector(selector);
if (pSelector.type === 'xpath') {
......@@ -264,7 +264,7 @@
* @return HTMLElement|undefined
*/
this.findOne = function findOne(selector, scope) {
scope = scope || document;
scope = scope || this.options.scope;
try {
var pSelector = this.processSelector(selector);
if (pSelector.type === 'xpath') {
......