当我通过html标签将TXT提取到csv文件中时,除了:
之外,一切都很完美每当出现#EANF#(未找到提取锚点)(意味着html元素不存在)时,imacros会跳到下一个有效的html标记。最后,csv文件如下所示:
bla sdjafl jsdfkl
bla #EANF# #EANF#
而不是我需要的:
bla #EANF# jsdfkl
bla sdjafl #EANF#
我的js看起来像这样:
var macro;
macro = "CODE:";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "SET !TIMEOUT_STEP 0" +"\n";
macro += "TAG POS={{i}} TYPE=H2 ATTR=* EXTRACT=TXT" + "\n";
macro += "WAIT SECONDS=0" + "\n";
macro += "SET !TIMEOUT_STEP 0" +"\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "TAG POS={{i}} TYPE=P ATTR=CLASS:hit_address EXTRACT=TXT" + "\n";
macro += "WAIT SECONDS=0" + "\n";
macro += "SET !TIMEOUT_STEP 0" +"\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "TAG POS={{i}} TYPE=P ATTR=CLASS:hit_phone_no EXTRACT=TXT" + "\n";
macro += "WAIT SECONDS=0" + "\n";
macro += "SET !TIMEOUT_STEP 0" +"\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "TAG POS={{i}} TYPE=P ATTR=CLASS:hit_fax_no EXTRACT=TXT" + "\n";
macro += "WAIT SECONDS=0" + "\n";
macro += "SET !TIMEOUT_STEP 0" +"\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "TAG POS={{i}} TYPE=LI ATTR=CLASS:website EXTRACT=TXT" + "\n";
macro += "WAIT SECONDS=0" + "\n";
macro += "SET !TIMEOUT_STEP 0" +"\n";
macro += "SET !ERRORIGNORE YES" + "\n";
macro += "TAG POS={{i}} TYPE=LI ATTR=CLASS:email EXTRACT=TXT" + "\n";
macro += "WAIT SECONDS=0" + "\n";
macro += "SAVEAS TYPE=EXTRACT FOLDER=* FILE=*" + "\n";
for(i=1;i<=15;i++){
iimSet("i",i);
iimPlay(macro);
iimGetExtract(i);
}
任何有关逐行保存提取的帮助都将非常感激。 提前谢谢