【发布时间】:2013-11-06 16:31:57
【问题描述】:
如何使用 if 语句检查页面内容,然后根据 if 语句执行操作?以下是点击时可能出现的结果:
图片1
http://i.imgur.com/V9rnrVS.png
图2
http://i.imgur.com/eeYhfXU.png
图3
http://i.imgur.com/W6Tjd8l.jpg
这是我的主线逻辑:
I will keep on clicking the box on the page [picture 1]
if it encounters [picture 2] click the box (i have the code for that)
else if it encounters [picture 3] refresh the page
else keep on clicking the box
如果图片不清晰,欢迎评论,我会尽力上传更清晰的图片。
所以现在我尝试构建代码,但它似乎不起作用。
Map.js
var test;
test ="CODE:";
test +="SET !ERRORIGNORE YES "+"\n";
test +="URL GOTO=http://tppcrpg.net/map.php?Map=11 "+"\n";
for (var i = 1; i < 10 ; i++)
{
iimSet("n",i)
iimPlay(test)
iimPlay("map1.iim")
}
map1.iim
TAG POS=1 TYPE=INPUT:IMAGE FORM=ACTION:/map.php?Map=11 ATTR=NAME:Find
它给了我这个错误:
[异常...“组件返回失败代码:0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH) [nsILocalFile.initWithPath]”nsresult:“0x80520001 (NS_ERROR_FILE_UNRECOGNIZED_PATH)”位置:“JS 框架 :: resource://imacros/utils.js :: :: line 192" data: no], line: 188 (Error code: 991)
使用Expert Complete HTML Code发现如果遇到【图3】有如下代码:
TAG POS=1 TYPE=H2 ATTR=*
TAG POS=2 TYPE=P ATTR=CLASS:center
【问题讨论】:
标签: javascript macros firefox-addon imacros