public class AutoTestCaseID {
ElementExist el = new ElementExist();
static AutoTestExcelFile ft = new AutoTestExcelFile();
SlidePage sp = new SlidePage();
public void Testcaseid(AppiumDriver driver,String id) throws InterruptedException, BiffException,IOException {
int i,j,k,l,m,n,o,p,q;
for(i=0;i<ft.ReadContent().size();i++)
{
if (ft.ReadContent().get(i).contains(id))
{
for (j=0;j<ft.ReadTitle().size();j++)
{
if (ft.ReadTitle().get(j).contains("定位方式"))
{
break;
}
}
String caseidLocation = ft.ReadTitleContent(i+1,j);
for(k=0;k<ft.ReadTitle().size();k++)
{
if (ft.ReadTitle().get(k).comtains("控件元素"))
{
break;
}
}
String caseidElement = ft.ReadTitleContent(i+1,k);
for(l=0;l<ft.ReadTitle().size();l++)
{
if(ft.ReadTitle().get(l).content("操作方法"))
{
break;
}
}
String caseidOperationMethod = ft.ReadTitleContent(i+1,l);
for (m=0;m<ft.ReadTitle().size();m++)
{
if (ft.ReadTitle().get(m).contains("测试数据"))
{
break;
}
}
String caseidTestData = ft.ReadTitleContent(i+1,m);
for (n=0;n<ft.ReadTitle().size();n++)
{
if (ft.ReadTitle().get(n).contains("验证数据"))
{
break;
}
}
String caseidVerifyData = ft.ReadTitleContent(i+1,n);
for (o=0;o<ft.ReadTitle().size();o++)
{
if (ft.ReadTitle().get(o).contains("延迟时间"))
{
break;
}
}
String SleepTime = ft.ReadTitleContent(i+1,o);
if (caseidLocation.equals("By.xpath"))
{
if (caseidOperationMethod.equals("sendkeys"))
{
el.waitForElementByXpath(caseidElement,driver);
driver.findElement(By.xpath(caseidElement)).sendkeys(caseidTestData);
if(SleepTime != null && SleepTime.length() != 0)
{
String StepTime = SleepTime.substring(0,SleepTime.indexOf("."));
Thread.sleep(Integer.parseInt(StepTime));
}
}else if(caseidOperationMethod.equals("click"))
{
}
}
}
}
}
}