Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 在iMacro中连续查找DIV_Javascript_Jquery_Imacros - Fatal编程技术网

Javascript 在iMacro中连续查找DIV

Javascript 在iMacro中连续查找DIV,javascript,jquery,imacros,Javascript,Jquery,Imacros,我是伊玛克罗的新手。我尝试录制一个脚本,当它出现在屏幕上时,我单击了一个弹出窗口。问题是,当发布任何新事件时,将出现弹出窗口。所以在制作脚本时它是可用的,但是当我循环脚本时,它得到了错误,因为它没有找到脚本 我的代码如下所示- EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUT

我是伊玛克罗的新手。我尝试录制一个脚本,当它出现在屏幕上时,我单击了一个弹出窗口。问题是,当发布任何新事件时,将出现弹出窗口。所以在制作脚本时它是可用的,但是当我循环脚本时,它得到了错误,因为它没有找到脚本

我的代码如下所示-

EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0
TAB T=2
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0
我在第一行出错了

错误代码:-921

是否有任何方法,如果发生任何错误,它将重新开始执行。 还有增加循环数的方法吗?
是否有任何方法,如果发生任何错误,它将重新开始执行

答复:

解决方法是将该行添加到imacros脚本的顶部

SET !ERRORIGNORE YES
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0
EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0
还有增加循环数的方法吗

答复: 您需要使用javascript并创建一个无限循环(如果需要),您可以通过按停止按钮结束此循环,因此我们将创建下面的文件macro.js,而不是imacros文件macro.iim。添加超时是因为将以1秒的间隔检查不同的选择器。如果需要,也可以将其设置为0

macro.js文件的内容如下:

var macro;
macro=  'CODE:';
macro+=  'SET !TIMEOUT_STEP 1' + '\n'; 
macro+=  'SET !ERRORIGNORE YES' + '\n'; 
macro+=  'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(7)>DIV:nth-of-type(2)>DIV>DIV>DIV>DIV>P:nth-of-type(2)" BUTTON=0' + '\n'; 
macro+=  'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(7)>DIV:nth-of-type(2)>A" BUTTON=0' + '\n';
macro+=  'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(10)>DIV:nth-of-type(5)>DIV>FOOTER>DIV>DIV:nth-of-type(2)>A:nth-of-type(2)" BUTTON=0' + '\n'; 
macro+=  'EVENT TYPE=CLICK SELECTOR="HTML>BODY>DIV:nth-of-type(4)>DIV:nth-of-type(2)>DIV>DIV:nth-of-type(11)>DIV>DIV:nth-of-type(3)>DIV:nth-of-type(2)>A" BUTTON=0' + '\n'; 

while(true){
    iimPlay(macro);
};

@这个答案对你有帮助吗?