本帖最后由 烟雨 于 2011-8-10 11:25 编辑
public void testMain(Object[] args)
{
RootTestObject root = getRootTestObject();
while(!dpDone()){
TestObject objuser[]=root.find(atDescendant("name","username"));
((TextGuiTestObject)objuser[0]).setText(dpString("username"));
TestObject objpwd[]=root.find(atDescendant("name","password"));
((TextGuiTestObject)objpwd[0]).setText(dpString("password"));
TestObject objsub[] = root.find(atDescendant(".class","Html.BUTTON",".type","submit"));
((GuiTestObject)objsub[0]).click();
String result = dpString("result");
TestObject objdlog[]=root.find(atDescendant(".class","Html.DialogStatic"));
if((objdlog.length>0)&&(result !=null))
{
String text = ((GuiTestObject)objdlog[1]).getProperty(".text").toString();
vpManual("vp1",result,text).performTest();
TestObject objsure[]=root.find(atDescendant(".text","确定"));
((GuiTestObject)objsure[0]).click();
}
else
{
RootTestObject root1 = getRootTestObject();
TestObject objtext[]=root1.find(atDescendant(".class","Html.DIV",".id","form_info"));
String text =((TextGuiTestObject)objtext[0]).getText();
vpManual("vp2",result,text);
TestObject objurl[]=root.find(atDescendant(".class","Html.HtmlDocument"));
((GuiTestObject)objurl[1]).setProperty(".url", "http://mail.163.com/");
}
dpNext();
}
}
数据池就不添加了,问题出现于当帐号或者密码错误的时候,页面跳转了:else语句中无法捕捉到对象,一直是数据越界。很是郁闷。今天网易居然还出问题,更郁闷。我只是想捕获DIV的文本用来做数据验证点!!! |