The fixing imacros interruption with Javascript

大城市里の小女人 提交于 2019-12-25 07:18:55

问题


I am currently downloading some files from the website. Due to the large amount of data that requires millions of clicks, I choose to use iMacros to accomplished the clicks. But the website is unstable and interrupt the automatic click from time to time. I had it fix some of problems while there is still one problem remaining.

The screenshot of the problem

The Picture shows the problems. It just stops and do not proceed. It does not return with an error but just stops.

In each specific line, they are designed to click at a button or to fill in some context. And sometimes the website is responding slowly and the button or the text frame do not show on time. Thus, the macros just stopped there. I was astonished to find that it is not return with a error but just stopped there.

I am looking for a solution on this so that whenever it stops like this, I can restart the current looping and do not miss the current line.

The following is the code for imacros. FYI. I sincerely appreciate that if you could help me out with this. Thanks!

1   TAB OPEN
2   WAIT SECONDS=1
3   TAB T=2
4   WAIT SECONDS=1
5   
6   SET myLoop EVAL("if ('{{myLoop}}' == '__undefined__') ml = 1576; else if ('{{!EXTRACT}}' == '' || '{{!EXTRACT}}' == '#EANF#') ml = ml; else ml = ++ml; ml;")
7   SET !EXTRACT NULL
8   
9   SET !DATASOURCE ???(????).csv
10  SET !DATASOURCE_COLUMNS 2
11  SET !DATASOURCE_LINE {{myLoop}}
12  SET !EXTRACT_TEST_POPUP NO
13  SET !TIMEOUT_STEP 40
14  
15  SET !ERRORIGNORE YES
16  URL GOTO=http://202.39.224.50/FMS_Plic/#
17  WAIT SECONDS=5
18  TAG POS=1 TYPE=A ATTR=TXT:????
19  
20  TAG POS=1 TYPE=A ATTR=TXT:????
21  WAIT SECONDS=3
22  
23  FRAME F=2
24  TAG POS=1 TYPE=A ATTR=ID:ddlDC_Arrow
25  TAG POS=1 TYPE=LI ATTR=TXT:???(????)
26  
27  TAG POS=1 TYPE=LI ATTR=TXT:???(????)
28  WAIT SECONDS=3
29  
30  TAG POS=1 TYPE=A ATTR=ID:ddlCar_Arrow
31  TAG POS=1 TYPE=LI ATTR=TXT:{{!COL1}}
32  
33  TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:date1 CONTENT={{!COL2}}
34  
35  TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:btnQuery
36  WAIT SECONDS=15
37  
38  TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Cexcel EXTRACT=TXT
39  TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Cexcel
40  WAIT SECONDS=60
41  
42  TAB CLOSE
43  WAIT SECONDS=1
44  SET !ERRORIGNORE NO

回答1:


Try to modify the myLoop variable in the following way:

SET myLoop EVAL("if ('{{myLoop}}' == '__undefined__') {try {ml = (confirm('CONTINUE FROM THE LOOP #' + ml + ' ?') ? ml : 1)} catch(e) {ml = 1;}} else if ('{{!EXTRACT}}' == '' || '{{!EXTRACT}}' == '#EANF#') ml = ml; else ml = ++ml; ml;")

(I suppose that the problem of macro stopping as you described above is a bug of 'iMacros for Chrome'. So my next suggestion may be to use 'iMacros for Firefox' and its JavaScript Scripting Interface instead.)



来源:https://stackoverflow.com/questions/39699450/the-fixing-imacros-interruption-with-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!