imacros if else javascript simple

2019-08-05 13:27发布

I have set up a basic webpage

testim.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Members</title>

</head>

<body>Done</body>

</html>

----------

I have then set up the following imacros script - very basic however everytime i run it though the if condition is not true. If i do a iimDisplay of the iimGetExtract it returns Done, and still the if condition is not true.

var macro_var;
macro_var="CODE:VERSION BUILD=8530828 RECORDER=FX\n";
macro_var+="TAB T=1\n";
macro_var+="URL GOTO=http://www.example.com/testim.html\n";
macro_var+="TAG POS=1 TYPE=BODY ATTR=TXT:* EXTRACT=TXT\n";

iimPlay(macro_var);

if(iimGetExtract(0)=="Done"){
iimDisplay("success");
}

Thanks

标签: imacros
1条回答
戒情不戒烟
2楼-- · 2019-08-05 14:02

Try this.

var macro_var;
macro_var="CODE:VERSION BUILD=8530828 RECORDER=FX\n";
macro_var+="TAB T=1\n";
macro_var+="URL GOTO=http://www.example.com/testim.html\n";
macro_var+="TAG POS=1 TYPE=BODY ATTR=TXT:* EXTRACT=TXT\n";

iimPlay(macro_var);

var result=iimGetLastExtract();

if(result=="Done"){
iimDisplay("success");
}
查看更多
登录 后发表回答