I have come across one obstacle when using the looping in imacros chrome version. I hope some one can help me out.
在imacros chrome版本中使用循环时,我遇到了一个障碍。我希望有人可以帮助我。
I am now trying to download some data concerning several districts and date. I have the the specific districts and dates stored in a .csv file. And I want to run the iMacros loop according to the index in that .csv file to automatically download those data. The following is the code in iMacros.
我现在正在尝试下载有关几个地区和日期的一些数据。我将特定的区域和日期存储在.csv文件中。我想根据.csv文件中的索引运行iMacros循环,以自动下载这些数据。以下是iMacros中的代码。
VERSION BUILD=844 RECORDER=CR
TAB OPEN
WAIT SECONDS=2
TAB T=2
WAIT SECONDS=2
SET !DATASOURCE Datasource.csv
SET !DATASOURCE_COLUMNS 3
SET !DATASOURCE_LINE {{!LOOP}}
URL GOTO=http://202.39.224.50/FMS_Plic/#
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=TXT:MonitorRecord
WAIT SECONDS=5
FRAME F=2
TAG POS=1 TYPE=A ATTR=ID:ddlDC_Arrow
TAG POS=1 TYPE=LI ATTR=TXT:DC1
WAIT SECONDS=10
TAG POS=1 TYPE=A ATTR=ID:ddlCar_Arrow
TAG POS=1 TYPE=LI ATTR=TXT:{{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:date1 CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:btnQuery
WAIT SECONDS=60
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Cexcel
WAIT SECONDS=60
TAB CLOSE
WAIT SECONDS=2
The code of iMacros itself has nothing wrong and it runs smoothly. However, the problem is that the website is unstable, crashing from time to time. If it crashes, the iMacros will be unable to find the related information the report errors, then exit. Due to the loop has to go from 1 to 300000, which takes a lot of time if I do it manually.
iMacros本身的代码没有错,它运行顺畅。但是,问题是网站不稳定,不时崩溃。如果崩溃,iMacros将无法找到报告错误的相关信息,然后退出。由于循环必须从1到300000,如果我手动操作需要花费很多时间。
So I am looking for a solution that fix this. If there is an error, restart the current loop, not skip(I noticed that someone suggest to use !ERRORIGNORE. But if I use that, the current loop will be skipped and that is not what I expect). And from some instructions online, javascript seems to be a solution. However, I know nothing about java as well as how to use javascript together with iMacros. If this can be solved on other browsers other than Chrome, please also let me know what to do.
所以我正在寻找解决这个问题的解决方案。如果有错误,重新启动当前循环,不要跳过(我注意到有人建议使用!ERRORIGNORE。但是如果我使用它,将跳过当前循环,这不是我所期望的)。从在线的一些说明,javascript似乎是一个解决方案。但是,我对java以及如何与iMacros一起使用javascript一无所知。如果可以在Chrome以外的其他浏览器上解决此问题,请告诉我该怎么做。
I sincerely appreciate any suggestions on this! Thanks a lot!:)
我真诚地感谢你对此有任何建议!非常感谢!:)
1 个解决方案
#1
0
I think this issue can be solved not only with 'iMacros for Firefox' (& its JavaScript Scripting Interface) but with 'iMacros for Chrome' as well. Suggest using the !ERRORIGNORE
. Let's define the myLoop
variable in order to restart the current loop when an error has appeared. I assume that it's equivalent to not finding the text of the element TAG POS=1 TYPE=A ATTR=TXT:MonitorRecord
. Here is a code to try and improve:
我认为这个问题不仅可以通过'iMacros for Firefox'(及其JavaScript脚本界面)来解决,还可以通过'iMacros for Chrome'来解决。建议使用!ERRORIGNORE。让我们定义myLoop变量,以便在出现错误时重新启动当前循环。我假设它相当于没有找到元素的文本TAG POS = 1 TYPE = A ATTR = TXT:MonitorRecord。这是一个尝试和改进的代码:
TAB OPEN
WAIT SECONDS=2
TAB T=2
WAIT SECONDS=2
SET myLoop EVAL("if ('{{myLoop}}' == '__undefined__') ml = 1; else if ('{{!EXTRACT}}' == '' || '{{!EXTRACT}}' == '#EANF#') ml = ml; else ml = ++ml; ml;")
SET !EXTRACT NULL
SET !DATASOURCE Datasource.csv
SET !DATASOURCE_COLUMNS 3
SET !DATASOURCE_LINE {{myLoop}}
SET !ERRORIGNORE YES
URL GOTO=http://202.39.224.50/FMS_Plic/#
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=TXT:MonitorRecord EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=TXT:MonitorRecord
WAIT SECONDS=5
FRAME F=2
TAG POS=1 TYPE=A ATTR=ID:ddlDC_Arrow
TAG POS=1 TYPE=LI ATTR=TXT:DC1
WAIT SECONDS=10
TAG POS=1 TYPE=A ATTR=ID:ddlCar_Arrow
TAG POS=1 TYPE=LI ATTR=TXT:{{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:date1 CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:btnQuery
WAIT SECONDS=60
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Cexcel
WAIT SECONDS=60
TAB CLOSE
WAIT SECONDS=2
SET !ERRORIGNORE NO
#1
0
I think this issue can be solved not only with 'iMacros for Firefox' (& its JavaScript Scripting Interface) but with 'iMacros for Chrome' as well. Suggest using the !ERRORIGNORE
. Let's define the myLoop
variable in order to restart the current loop when an error has appeared. I assume that it's equivalent to not finding the text of the element TAG POS=1 TYPE=A ATTR=TXT:MonitorRecord
. Here is a code to try and improve:
我认为这个问题不仅可以通过'iMacros for Firefox'(及其JavaScript脚本界面)来解决,还可以通过'iMacros for Chrome'来解决。建议使用!ERRORIGNORE。让我们定义myLoop变量,以便在出现错误时重新启动当前循环。我假设它相当于没有找到元素的文本TAG POS = 1 TYPE = A ATTR = TXT:MonitorRecord。这是一个尝试和改进的代码:
TAB OPEN
WAIT SECONDS=2
TAB T=2
WAIT SECONDS=2
SET myLoop EVAL("if ('{{myLoop}}' == '__undefined__') ml = 1; else if ('{{!EXTRACT}}' == '' || '{{!EXTRACT}}' == '#EANF#') ml = ml; else ml = ++ml; ml;")
SET !EXTRACT NULL
SET !DATASOURCE Datasource.csv
SET !DATASOURCE_COLUMNS 3
SET !DATASOURCE_LINE {{myLoop}}
SET !ERRORIGNORE YES
URL GOTO=http://202.39.224.50/FMS_Plic/#
WAIT SECONDS=2
TAG POS=1 TYPE=A ATTR=TXT:MonitorRecord EXTRACT=TXT
TAG POS=1 TYPE=A ATTR=TXT:MonitorRecord
WAIT SECONDS=5
FRAME F=2
TAG POS=1 TYPE=A ATTR=ID:ddlDC_Arrow
TAG POS=1 TYPE=LI ATTR=TXT:DC1
WAIT SECONDS=10
TAG POS=1 TYPE=A ATTR=ID:ddlCar_Arrow
TAG POS=1 TYPE=LI ATTR=TXT:{{!COL1}}
TAG POS=1 TYPE=INPUT:TEXT FORM=ID:form1 ATTR=ID:date1 CONTENT={{!COL2}}
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:btnQuery
WAIT SECONDS=60
TAG POS=1 TYPE=INPUT:SUBMIT FORM=ID:form1 ATTR=ID:Cexcel
WAIT SECONDS=60
TAB CLOSE
WAIT SECONDS=2
SET !ERRORIGNORE NO