gpt4 book ai didi

javascript - CasperJS 传递变量进行评估无法使其正常工作

转载 作者:行者123 更新时间:2023-12-03 11:14:47 25 4
gpt4 key购买 nike

<分区>

好的,这是我的 casperjs 函数:

if(casper.exists(ac2)){

var accountnumber = this.fetchText('div.arabic:nth-child(2) > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(2) > td:nth-child(2) > a:nth-child(1)');
var redir = accountnumber.substr(1);

casper.then(function() {

var uel = "https://example.ws/send.html?f=" + redir;
this.thenOpen(uel, function() {
casper.wait(10000, function() {
casper.then(function() {
var accountnumber1 = this.fetchText('div.arabic:nth-child(1) > font:nth-child(1)');
var acccc = accountnumber1.split(' ');
system.stdout.writeLine(acccc[3]); // this output a number
var amount = acccc[3];
var result = amount * 0.019;
var result2 = result.toFixed(6);
var fresult = amount - result2;
var needed = fresult.toFixed(3);
system.stdout.writeLine(needed); // this output a number
this.evaluate(function() {

document.getElementById('account').value = '6028';
document.getElementsByName('data')[0].value = needed; // this just does not work even though i know there a number needed in var needed

});
//this.click("input#sbt.button[type='submit']");

casper.wait(10000, function() {
casper.then(function() {
this.capture("capture1.jpg");
var el2 = this.getHTML();
fs.write('result.html', el2, 'w');
});
});
});});
});
});

} else {

this.exit();

}

出于某种原因,我无法将变量正确发送到此函数:

    this.evaluate(function() {

document.getElementById('account').value = '6028';
document.getElementsByName('data')[0].value = needed; // this just does not work even though i know there a number needed in var needed

});

谁能帮我解决这个问题,以便正确传递数字以评估功能。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com