0
CasperJS에서 평가하는 함수에 매개 변수를 전달하려면 어떻게해야합니까?CasperJS의 평가에서 매개 변수를 전달하는 방법
//Should be logged in at this point
casper.then(function() {
var counter = 0;
var cap = 500;
this.evaluate(function(counter) {
var children = $('.companies-using-service').children();
while (counter < children.length) {
child = children[counter];
console.log($(child).find('a').attr('data-hint'));
counter++;
}
}, counter);
});
};
var scrapeClients = function(counter) {
var children = $('.companies-using-service').children();
while (counter < children.length) {
child = children[counter];
console.log($(child).find('a').attr('data-hint'));
counter++;
}
}
이상, 나는 매개 변수가없는 함수를 사용할 수 있습니다. 그러나, 나는 evaluate 함수에 scrapeClients
함수를 전달하고자한다. 이 경우 다음을 시도했습니다. this.evaluate(scrapeClients(counter), counter)
. 그러나이 작동하지 않으며 오류는 $
변수를 찾을 수 없다고 말합니다.