请找到我的代码,它不返回数组对象值,它只返回一个数组对象
public String[] verify_userRole(String[] Expected_role) {
String[] actual_role = new String[4];
String first;
WebElement role_table = driver.findElement(By
.xpath("//*[@id='tblListView']/tbody[1]"));
List<WebElement> allRows = role_table.findElements(By.tagName("tr"));
for (WebElement row : allRows) {
List<WebElement> cells = row.findElements(By.tagName("td"));
for (WebElement cell : cells) {
first = cell.getText().toString();
actual_role = new String[] {first};
}
}
return actual_role;
}
变量首先包含四个值(“name”,“name1”,“name2”,“name3”),然后将此字符串值转换为数组(actual_role),然后仅返回一个值(“name”)
请澄清上述代码的问题是什么