我正在嘗試使用this.evaluate()
調用另一個模塊中定義的函數。
的代碼片段(調用函數)爲:
this.waitFor(function check() {
var re = this.evaluate(universe.answer(couponElement, url));
if (re != 'no' & re!='yes' & re!=null) {
couponObj.push(re);
並且其中該函數定義的模塊是這樣的:
var require = patchRequire(require);
var utils = require('utils');
exports.answer = function(couponElement, url) {
var lblInvalidCoupon = 'lblInvalidCoupon';
var tolTipCouponinner='tolTipCouponinner';
var txtFCCoupondisocunt = 'txtFCCoupondisocunt';
var btnRemoveFCCoupon = 'btnRemoveFCCoupon';
var check = $('#txtCouponCode').css('backgroundImage');
if (check.indexOf('ajax-loader.gif')>-1){
return 'no';
} else {
if (document.getElementById(lblInvalidCoupon)!=null){
基本上,我想使用調用的函數this.evaluate
但無法這樣做。
您是否檢查過以確保遠程頁面已加載jQuery?您可以通過訪問瀏覽器中的頁面並嘗試使用瀏覽器的開發人員工具使用jQuery函數來完成此操作。 – hexid
可能的重複[在JavaScript中,如果我用圓括號調用一個函數,它會有所作爲嗎?](http://stackoverflow.com/questions/3246928/in-javascript-does-it-make-a-difference-if -i-呼叫一個功能與 - 括號內) –