网上搜了好多代码,不管用,ms是适合7.0版本的:
public TestObject getLinkTestObject()
{
RootTestObject root = getRootTestObject();
TestObject[] tos = root.find(atDescendant(".txt","Html.A", ".text","L77"));
if(tos.length >0 )
{
System.out.println(tos[0].getProperty(".href").toString());
return tos[0];
}
发现这些连root好像都没取对,后来这个办法搞定:
public TestObject getLinkTestObject()
{
TestObject[] to = find(
SubitemFactory.atDescendant(".class", "Html.HtmlDocument",
".title", "IBM WebSphere Sensor Events | Administrative Console"));
TestObject root = to[0];
System.out.println(root.getProperty(".url").toString());
TestObject[] tos = find(SubitemFactory.atDescendant(".class","Html.A", ".text","L77"));
if(tos.length >0 )
{
System.out.println(tos[0].getProperty(".href").toString());
return tos[0];
}
return null;
}