iMacro - 在TAG命令中使用XPATH - TAG命令的格式错误

时间:2015-07-06 00:14:37

标签: xpath tags command imacros

我在这个宏的第4行得到错误的TAG命令格式。奇怪的是,当我删除变量并将TAG行作为一个单独的宏运行时,它工作正常。我甚至删除了变量并放入在1代替它,但仍然显示相同的错误。任何人都可以请求帮助吗?我到处寻找答案。

const L = "\n";
    var pc;
    var bret;
        pc = 1;
        bret = 1;
        while (pc < 16 && bret > 0) {
              iimSet("VAR1",pc)
               bret = iimPlayCode("TAG XPATH=/html/body/form/div[3]/div[7]/div[1]/div[2]/div[3]/div[{{!VAR1}}]/div/div/div[1]/div[2]/div[1]/a" + L +
                                  "WAIT SECONDS=3" + L +
                                  "TAG POS=1 TYPE=DIV ATTR=ID:NavLink EXTRACT=TXT"  + L +
                                  "TAG POS=1 TYPE=SPAN ATTR=ID:lblTitle EXTRACT:TXT" + L +
                                  "TAG POS=1 TYPE=SPAN ATTR=ID:lblPrice EXTRACT:TXT" + L +
                                  "SCREENSHOT TYPE=PAGE FOLDER=* FILE="+pc + L +
                                  "SAVEAS TYPE=EXTRACT FOLDER=* FILE=wassup.csv" + L +
                                  "BACK");
                pc++;
                }

1 个答案:

答案 0 :(得分:0)

我自己想通了。这发生在iimPlayCode的第4行,EXTRACT:提到了TXT,而它应该是EXTRACT = TXT。

const L = "\n";
    var pc;
    var bret;
        pc = 1;
        bret = 1;
        while (pc < 16 && bret > 0) {
              iimSet("VAR1",pc);
               bret = iimPlayCode("TAG XPATH=/html/body/form/div[3]/div[7]/div[1]/div[2]/div[3]/div[{{!VAR1}}]/div/div/div[1]/div[2]/div[1]/a" + L +
                                  "WAIT SECONDS=3" + L +
                                  "TAG POS=1 TYPE=DIV ATTR=ID:NavLink EXTRACT=TXT"  + L +
                                  "TAG POS=1 TYPE=SPAN ATTR=ID:lblTitle EXTRACT=TXT" + L +
                                  "TAG POS=1 TYPE=SPAN ATTR=ID:lblPrice EXTRACT=TXT" + L +
                                  "SCREENSHOT TYPE=PAGE FOLDER=* FILE="+pc + L +
                                  "SAVEAS TYPE=EXTRACT FOLDER=* FILE=wassup.csv" + L +
                                  "BACK");
                pc++;
                }