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.