|
可以啊,今天我实现了一个api,你可以参考一次,和你的不一样,我是将对象的值与我想要的值进行比较。
用例这样写:
<object>textCheck</object>
<value>xpath=/x:html/x:body/body/x:tr[2]/x:td[3]/x==已汇出</value>
api这样写:
public static boolean textCheck(CommandProcessor comdp, String value, boolean state)
{
log.info("对象验证");
String[] val = value.split("==");
String object = val[0];
String comparison = val[1];
String reality = comdp.getString("getText", new String[] { object });
reality = reality.trim();
if (reality.equals(comparison))
{
log.info(reality + " and " + comparison + "比对成功");
state = true;
}
else {
log.info(reality + " and " + comparison + "比对失败");
state = false;
}
return state;
}
} |
|