TA的每日心情 | 奋斗 2017-8-2 15:14 |
---|
签到天数: 1 天 连续签到: 1 天 [LV.1]测试小兵
|
方法如下:public void input(String sheet,String objectName,String value) throws Exception {
ReadExcelUtil ex=new ReadExcelUtil(path, sheet);
String[] locator=ex.getvalue(objectName);
switch (locator[1]) {
case "id":
driver.findElement(By.id(locator[0])).sendKeys(value);
System.out.println(driver.findElement(By.id(locator[0])).getText());
break;
case "xpath":
driver.findElement(By.xpath(locator[0])).sendKeys(value);
break;
case "name":
driver.findElement(By.name(locator[0])).sendKeys(value);
break;
case "class":
driver.findElement(By.className(locator[0])).sendKeys(value);
break;
default:
break; |
|