gpt4 book ai didi

javascript - 如何使页面以随机像素和随机方向滚动

转载 作者:行者123 更新时间:2023-12-03 03:00:58 26 4
gpt4 key购买 nike

在 imacros 中,我使用 JavaScript 语言,这里是一些代码:

var filesource = imns.Dialogs.browseForFileOpen("Enter file location");
if (filesource)
fs = filesource.path;
var y = prompt("start","2");
var z = prompt("end","20");

y=parseInt(y);
z=parseInt(z);

posting="CODE:"+"\n"
posting+="SET !ERRORIGNORE YES"+"\n"
posting+="SET !DATASOURCE {{filesource}}"+"\n"
posting+="SET !DATASOURCE_LINE {{LOOP}}"+"\n"
posting+="SET !WAITPAGECOMPLETE YES"+"\n"
posting+="URL GOTO=https://www.examples.com"+"\n"
posting+="TAG POS=1 TYPE=SPAN ATTR=CLASS:selectBox-arrow"+"\n"
posting+="TAG POS=1 TYPE=SELECT FORM=NAME:frm_add_product ATTR=NAME:p_dep_1 CONTENT=%0"+"\n"
posting+="WAIT SECONDS=2"+"\n"

posting+="TAG POS=1 TYPE=SELECT FORM=NAME:frm_add_product ATTR=NAME:p_menu_id CONTENT=${{!COL23}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:FILE FORM=ID:frm-add-product ATTR=accept:image/jpeg,image/png CONTENT={{!COL11}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:FILE FORM=ID:frm-add-product ATTR=accept:image/jpeg,image/png CONTENT={{!COL12}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:FILE FORM=ID:frm-add-product ATTR=accept:image/jpeg,image/png CONTENT={{!COL13}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:FILE FORM=ID:frm-add-product ATTR=accept:image/jpeg,image/png CONTENT={{!COL14}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:FILE FORM=ID:frm-add-product ATTR=accept:image/jpeg,image/png CONTENT={{!COL15}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-add-product ATTR=ID:p-name CONTENT={{!COL1}}"+"\n"
posting+="TAG POS=1 TYPE=TEXTAREA FORM=ID:frm-add-product ATTR=ID:p-description CONTENT={{!COL6}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-add-product ATTR=ID:p-price CONTENT={{!COL3}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-add-product ATTR=ID:p-weight CONTENT={{!COL4}}"+"\n"
posting+="TAG POS=1 TYPE=INPUT:RADIO FORM=ID:frm-add-product ATTR=ID:p-condition-new"+"\n"
posting+="TAG POS=1 TYPE=SPAN ATTR=CLASS:selectBox-arrow"+"\n"
posting+="TAG POS=1 TYPE=SELECT FORM=NAME:frm_add_product ATTR=NAME:p_dep_1 CONTENT=${{!COL8}}"+"\n"
posting+="WAIT SECONDS=2"+"\n"
posting+="TAG POS=2 TYPE=SPAN ATTR=CLASS:selectBox-arrow"+"\n"
posting+="TAG POS=1 TYPE=SELECT FORM=NAME:frm_add_product ATTR=NAME:p_dep_2 CONTENT=${{!COL9}}"+"\n"
posting+="WAIT SECONDS=2"+"\n"
posting+="TAG POS=3 TYPE=SPAN ATTR=CLASS:selectBox-arrow"+"\n"
posting+="TAG POS=1 TYPE=SELECT FORM=NAME:frm_add_product ATTR=NAME:p_dep_3 CONTENT=${{!COL10}}"+"\n"
posting+="WAIT SECONDS=2"+"\n"
posting+="TAG POS=1 TYPE=SELECT FORM=NAME:frm_add_product ATTR=NAME:p_menu_id CONTENT=$**<SP>Tambah<SP>Etalase"+"\n"
posting+="TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-add-product ATTR=ID:p-menu-name CONTENT={{!COL16}}"+"\n"
posting+="TAG POS=1 TYPE=SELECT FORM=NAME:frm_add_product ATTR=NAME:p_menu_id CONTENT=${{!COL16}}"+"\n"
posting+="TAG POS=1 TYPE=a ATTR=ID:invenagebox"+"\n"
posting+="TAG POS=1 TYPE=INPUT:TEXT FORM=ID:frm-add-product ATTR=ID:invenage-value CONTENT={{!COL5}}"+"\n"
posting+="WAIT SECONDS=2"+"\n"
posting+="TAG POS=1 TYPE=BUTTON FORM=ID:frm-add-product ATTR=ID:s-save-prod"+"\n"
posting+="WAIT SECONDS=10"+"\n"
posting+="TAG POS=1 TYPE=ul ATTR=class:square<sp>break-word extract=txt"+"\n"
posting+="set nama EVAL(\"'{{!EXTRACT}}'.replace('Anda telah berhasil memasukkan produk ','')\")"+"\n"
for (i=y;i<=z;i++){
iimSet("cat1",cat1);
iimSet("cat2",cat2);
iimSet("cat3",cat3);
iimSet("ETA",eta);
iimSet("filesource",fs);
iimSet("LOOP",i);
iimPlay(posting);

}

所以重点是我想让页面以随机方向和随机像素滚动。我尝试过使用 URL GOTO=javascript:window.scrollBy(0,2000),但没有成功。

注意:我使用 Excel 逗号分隔值(CSV)作为我的代码源,我想向 Excel 工作表的每一行添加一些随机数,但它不起作用,因为 URL GOTO=javascript: window.scrollBy(0,2000) 这不起作用。

最佳答案

而不是

URL GOTO=javascript:window.scrollBy(0,randomNumber)

您可以尝试以下代码:

' your value here '
SET maxScroll 50
SET keys EVAL("var k = []; for (i = 0; i <= 1 + Math.floor(Math.random()*{{maxScroll}}); i++) k.push(40); k;")
EVENTS TYPE=KEYPRESS SELECTOR=* KEYS="[{{keys}}]"

因此,您不需要向 Excel 工作表的每一行添加一些随机数。

<小时/>

用 JavaScript 封装:

// ...
posting += 'SET maxScroll 50' + "\n";
posting += 'SET keys EVAL("var k = []; for (i = 0; i <= 1 + Math.floor(Math.random()*{{maxScroll}}); i++) k.push(40); k;")' + "\n";
posting += 'EVENTS TYPE=KEYPRESS SELECTOR=* KEYS="[{{keys}}]"' + "\n";
// ...

关于javascript - 如何使页面以随机像素和随机方向滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47393552/

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