【发布时间】:2015-04-01 00:06:41
【问题描述】:
我需要从我的应用程序中识别 Html.SELECT 对象并选择它。 我成功地做到了这一点,但现在我不能在我的代码中写出整个 .text 字符串,因为它是所有位置的长列表。 如何提取该值并将其与正则表达式进行比较。 例如 - .text 是 District................................................. .....
我想要一个字符串变量作为 District.* 在下面的代码中,我需要字符串名称作为正则表达式
SelectMCASDistrict("District.*");
public static void SelectMCASDistrict(String name)
{
GuiTestObject textObj = findTextObjectDist(name);
if (textObj != null) {
((SelectGuiSubitemTestObject) textObj).select("Abington.*");
} else {
throw new ObjectNotFoundException();
}
}
private static GuiTestObject findTextObjectDist(String name)
{
TestObject[] tobs = find(atDescendant(".class", "Html.SELECT", ".text", name ), true);
if(tobs.length == 0)
return null;
return (GuiTestObject)tobs[0];
}
【问题讨论】:
标签: rft