我试图使用iMacros与Firefox一起点击UnFollow按钮,如果该代码存在于页面上...
<small class="follow-status">follows you</small>
Run Code Online (Sandbox Code Playgroud)
如果页面源中不存在上述内容,那么它将运行此iMacros代码...
TAG POS=1 TYPE=DIV ATTR=TXT:UnFollow
Run Code Online (Sandbox Code Playgroud)
根据我的阅读,没有if/else类型语法,但你可以运行Javascript
EVAL("Javascript code here")
Run Code Online (Sandbox Code Playgroud)
如果有人知道我怎么做,我真的可以使用帮助
你可以欺骗Imacros制作一个If语句,但首先你必须SET !ERRORIGNORE YES为这个宏.然后:
SET EXTRACT NULL
'if this exist you extract the text(even if you know it)
'if doesn't exist should return error but we turned that off; Extract remains Null
TAG POS=1 TYPE=SMALL ATTR=TXT:follows<SP>you EXTRACT=TXT
SET !VAR1 EVAL("var text=\"{{!EXTRACT}}\"; if(text==\"follows you\") text = \"jibber\";else text = \"UnFollow\";text;")
'this one executes if the text is right, if not should give error but we turned that off
TAG POS=1 TYPE=DIV ATTR=TXT:{{!VAR1}}
Run Code Online (Sandbox Code Playgroud)