如果iMacros的页面中存在文本,请单击一个按钮 [英] Click a button if text exist in page with iMacros

查看:63
本文介绍了如果iMacros的页面中存在文本,请单击一个按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将iMacros与Firefox配合使用,仅在页面上存在此代码的情况下才单击取消关注"按钮...

I am trying to use iMacros with Firefox to click an UnFollow button ONLY if this code exist on the page...

<small class="follow-status">follows you</small>

如果页面源代码中不存在以上内容,则它将运行此iMacros代码...

If the above does not exist in the page source then it would run this iMacros code...

TAG POS=1 TYPE=DIV ATTR=TXT:UnFollow

根据我的阅读,没有if/else类型的语法,但是可以使用以下语言运行Javascript

From what I have read, there is no if/else type syntax but you can run Javascript with

EVAL("Javascript code here")

如果有人知道我该怎么做,我真的可以使用帮助

If anyone knows how I could do this I could really use the help

推荐答案

您可以欺骗Imacros来创建If语句,但是首先必须对该宏进行SET !ERRORIGNORE YES.然后:

You can trick Imacros to make an If statement, but first you have to SET !ERRORIGNORE YES for this macro. Then:

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}}

这篇关于如果iMacros的页面中存在文本,请单击一个按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆