I have just joined on here and am still learning imacros and java so apologies if I seem a little slow ! I currently have this code in imacros to check an element for a certain value , and then to do workarounds in java:
TAG POS=1 TYPE=P ATTR=TXT:* EXTRACT=TXT
SET !VAR2 EVAL("var s=\"{{!EXTRACT}}\"; if(s.match(\"error\")){url=\"imacros://run/?m=#Current.js\";} else url=\"imacros://run/?m=#Current2.iim\"; url;")
URL GOTO={{!VAR2}}
I know its not fantastically optimised but it works. But heres the new problem. I need to do it again on a different element that isnt always there . So how do I go about that ? This is the relevant imacros line...
TAG POS=1 TYPE=SPAN ATTR=TXT:Click
So yeah I need to extract it and compare like the first example , but like I say, its only there about 20-30% of the time . So it needs to be checked to see if it exists , if it does then run the if else , and if not then to continue as normal .
Thanks in advance guys !
If there is a more efficient way of doing things in the first example then that would be great too because I am aware that its bloaty , and makes FF hog more memory
And yes I've searched and saw this :
Check if html element exists with iMacros and javascript
and this:
Check if element exists in jQuery
But I am still confused and overwhelmed because I am quite new to js.....