动态帧名称

时间:2018-05-05 01:57:47

标签: javascript imacros

请帮我解决这个问题; 如何通过“mainFrame”和“rf”变量名创建变量或动态框架名称?

var variance = "CODE:";
variance += "VERSION BUILD=8970419 RECORDER=FX" + "\n";
variance += "TAB T=1" + "\n";
variance += "SET !REPLAYSPEED FAST" + "\n";
variance += "SET !ERRORIGNORE YES" + "\n";
variance += "SET !TIMEOUT_PAGE 20" + "\n";
variance += "SET !TIMEOUT_STEP 0" + "\n";
variance += "SET !DATASOURCE_LINE {{!LOOP}}" + "\n";
variance += "SET !DATASOURCE Shoes<SP>05-04-2018.csv" + "\n";
variance += "SET !LOOP 4" + "\n";
variance += "FRAME NAME=\"mainFrame\"" + "\n";
variance += "EVENT TYPE=CLICK SELECTOR=\"#mainContent>DIV:nth-of-type(29)>DIV>DIV>INPUT:nth-of-type(2)\" BUTTON=0" + "\n";
variance += "TAG POS=1 TYPE=INPUT:TEXT ATTR=TYPE:text&&ONCHANGE:publishVipJS.changeAlias(this,<SP>'text');&&VALUE:XXS CONTENT=" + "\n";
variance += "FRAME F=0" + "\n";
variance += "TAG POS=1 TYPE=A ATTR=CLASS:btn" + "\n";
variance += "FRAME NAME=\"rf\"" + "\n";
variance += "TAG POS=101 TYPE=INPUT:TEXT ATTR=* CONTENT={{!COL22}}" + "\n";
variance += "TAG XPATH =\"//*[@id=\"mainContent\"]/div[29]/div/div[1]/input[2]\" EXTRACT=TXT" + "\n";
variance += "prompt {{!EXTRACT}}" + "\n";
variance += "FRAME F=0" + "\n";
variance += "TAG POS=1 TYPE=A ATTR=CLASS:btn" + "\n";
iimPlay(variance);

var extract = iimGetLastExtract();
if (extract !== '') {
    var CHECK1 = "CODE:";
    CHECK1 += "SET !TIMEOUT_STEP 0" + "\n";
    CHECK1 += "FRAME NAME=\"mainFrame\"" + "\n";
    CHECK1 += "TAG POS=1 TYPE=LABEL ATTR=ONCLICK:publishVipJS.toggleSaleAttr(this,'text');&&FOR:testsale2260958&&DATA:9248:2260958&&TXT:" + "\n";
    CHECK1 += "TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:testsale2260958 CONTENT=YES" + "\n";
    iimPlay(CHECK1);
    var notif = alert("SUCCES");
}else{
    var UNCHECK1 = "CODE:";
    UNCHECK1 += "SET !TIMEOUT_STEP 0" + "\n";
    UNCHECK1 += "FRAME NAME=\"mainFrame\"" + "\n";
    UNCHECK1 += "TAG POS=1 TYPE=LABEL ATTR=ONCLICK:publishVipJS.toggleSaleAttr(this,'text');&&FOR:testsale2260958&&DATA:9248:2260958&&TXT:" + "\n";
    UNCHECK1 += "TAG POS=1 TYPE=INPUT:CHECKBOX ATTR=ID:testsale2260958 CONTENT=NO" + "\n"
    iimPlay(UNCHECK1);
    var notif = alert("NULL");
}

在行

CHECK1 += "FRAME NAME=\"mainFrame\"" + "\n";
UNCHECK1 += "FRAME NAME=\"mainFrame\"" + "\n";

包含动态帧名称,是2帧名称“mainFrame”和“rf”, 如何通过“mainFrame”和“rf”变量名创建变量或动态框架名称?

1 个答案:

答案 0 :(得分:0)

以下代码应该有效:

// ...
var mainFrame = "dynamicFrameName";
// ...
CHECK1 += "FRAME NAME=" + mainFrame + "\n";
// ...