admin管理员组文章数量:1335413
I want to check if an HTML element exist with iMacros. If it does, I want to go to a URL. If not, I want to go to other URL.
Because iMacros doesn't have statements, I used javascript with the iMacros' EVAL. Here is the line that handles the javascript execution:
SET !VAR3 EVAL("var element = window.content.document.getElementById(\"some_element\");
if (typeof(element) != 'undefined' && element != null) {
var redirect = 'http://192.168.178.22/sc/report.php';
} else {
var redirect = 'http://192.168.178.22/sc/index.php?action=connect';
}
redirect;
")
*It's all in one line, but I formatted it for here.
Then, I will redirect with
URL GOTO={{!VAR3}}
The problem is in both of the cases, the !VAR3 is set to 'undefined.'
I tried almost the same JS code on Firefox only, and it seems to be working.
Windows 8 with the latest Firefox and the latest iMacros version.
Thank you.
I want to check if an HTML element exist with iMacros. If it does, I want to go to a URL. If not, I want to go to other URL.
Because iMacros doesn't have statements, I used javascript with the iMacros' EVAL. Here is the line that handles the javascript execution:
SET !VAR3 EVAL("var element = window.content.document.getElementById(\"some_element\");
if (typeof(element) != 'undefined' && element != null) {
var redirect = 'http://192.168.178.22/sc/report.php';
} else {
var redirect = 'http://192.168.178.22/sc/index.php?action=connect';
}
redirect;
")
*It's all in one line, but I formatted it for here.
Then, I will redirect with
URL GOTO={{!VAR3}}
The problem is in both of the cases, the !VAR3 is set to 'undefined.'
I tried almost the same JS code on Firefox only, and it seems to be working.
Windows 8 with the latest Firefox and the latest iMacros version.
Thank you.
Share Improve this question edited Feb 1, 2015 at 16:42 Deduplicator 45.7k7 gold badges72 silver badges123 bronze badges asked Apr 23, 2013 at 16:34 user2312194user2312194 331 gold badge1 silver badge3 bronze badges1 Answer
Reset to default 4var macro;
macro ="CODE:";
macro +="TAG POS=1 TYPE=DIV ATTR=CLASS:some_class CONTENT=EVENT:MOUSEOVER ";
var ret=null;
ret=iimPlay(macro);
if(ret>0)
{
//do something
}
else
{
//do something else
}
This would be the basic model of the script you want. You just have to insert the proper imacros code.
本文标签: Check if html element exists with iMacros and javascriptStack Overflow
版权声明:本文标题:Check if html element exists with iMacros and javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742385415a2464933.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论