for循环中的java Web元素
for (int i = 1; i >=0 ; i--) {
driver.findElement(By.cssSelector("form.form-inline > input:nth-of-type(1)")).sendKeys(n);
Select option = new Select(driver.findElement(By.cssSelector("select")));
option.selectByValue("MULTIPLICATION");
driver.findElement(By.cssSelector("form.form-inline > input:nth-of-type(2)")).sendKeys(String.valueOf(i));
driver.findElement(By.id("gobutton")).click();
Thread.sleep(5000);
/** vvv Line Below vvv **/
String q =(driver.findElement(By.className("ng-binding")).getText());
}
每次循环进行时,我突出显示的一个都会发生变化。 如何将每次文本保存到不同的字符串
# 1 楼答案
创建一个
ArrayList
的String
,如