iMacro 查找元素
iMacro Finding an Element
我正在编写一个C++的iMacro脚本,该脚本将登录到网站,转到特定页面并查找复选框。如果该复选框不存在,则脚本将每 X 秒刷新一次页面。如果该复选框确实存在,那么它将选中它。基本上,我只需要弄清楚如何让iMacro搜索复选框。这是我到目前为止的代码:
using namespace System;
#include <string>
int timeout = 60;
ref class ManagedGlobals {
public:
static iMacros::AppClass^ app;
};
// test if element exists
bool doesElementExist() {
iMacros::Status stat;
ManagedGlobals::app->iimDisplay("Searching for element", timeout);
stat = ManagedGlobals::app->iimPlay("CODE:SET !TIMEOUT_TAG 1n"
+ "CODE:TAG POS=8 TYPE=INPUT:CHECKBOX FORM=ACTION:/pls/PROD/bwykfreg.P_AltPin1?deviceType=C ATTR=NAME:sel_crn EXTRACT=TXT", timeout);
ManagedGlobals::app->iimDisplay(stat.ToString(), timeout);
ManagedGlobals::app->iimPlay("CODE:WAIT SECONDS=10", timeout);
if (stat != iMacros::Status::sOk) {
ManagedGlobals::app->iimDisplay("Didn't find it", timeout);
return false;
}
ManagedGlobals::app->iimDisplay("Found it", timeout);
return true;
}
我已经在页面上对此进行了测试,复选框确实存在,但脚本找不到它,而是返回错误代码 -1100,根据此页面,这意味着Load Failed: Failed to load the macro (syntax or I/O error) (Found wrong macro command while loading file).
有人知道问题是什么吗?
尝试删除此部分。
FORM=ACTION:/pls/PROD/bwykfreg.P_AltPin1?deviceType=C
此部分可以在页面上更改,但 TAG 不需要它来查找元素。还尝试通过更改POS = 8来更改复选框的位置。从数字 1 开始到 15,看看这个数字是否也会改变。
此外,您可能还想更改此设置
stat = ManagedGlobals::app->iimPlay("CODE:SET !TIMEOUT_TAG 1n"
+ "CODE:TAG POS=8 TYPE=INPUT:CHECKBOX FORM=ACTION:/pls/PROD/bwykfreg.P_AltPin1?deviceType=C ATTR=NAME:sel_crn EXTRACT=TXT", timeout);
进入这个
stat = ManagedGlobals::app->iimPlay("CODE:SET !TIMEOUT_TAG 1n"
+ "TAG POS=8 TYPE=INPUT:CHECKBOX ATTR=NAME:sel_crn EXTRACT=TXT", timeout);
代码:在一个宏中只能出现一次。 n
用于拆分命令行。
相关文章:
- 使用堆查找第K个最大元素的时间复杂性
- 查找矩阵C++中每一列和每一行的最小和最大元素
- C++如何在向量中查找最常见的元素
- 查找两个排序向量中共有的元素
- 在对向量中查找元素的索引
- 查找数组中第一个最小值和最后一个最大值元素之间的算术平均值
- 查找矩阵中单元格的相邻元素
- 为什么使用数组元素查找最大数字的程序不起作用?
- 查找第一个数组中不存在的元素
- 查找最小的下一个更大的元素
- 在最小堆中查找最大元素
- 在向量中查找大于 0(或通常为 k)的最小元素的最佳方法是什么?
- set::find 查找不存在的元素
- 在集合中查找使用结构C++的元素
- 从斐波那契序列 c++ 中的数组中查找正确的元素时出错
- 用于查找数组中最大元素的出现次数的代码,给出分段错误
- 查找数组中指示性较大但数组中值较小的元素
- C++结构集无法按元素查找/擦除
- 如何在OpenCV中使用Matlab的512元素查找表数组?
- 使用数组的元素查找总和'k'