findElements 的用法

代码如下:
Then("the AmexPoints option is not visible")
var pointsProgramOptionList:util.List[WebElement] =webDriver.findElements(By.className("points-program-option"))
for(i<- 0 to pointsProgramOptionList.size()-1) yield {
pointsProgramOptionList.get(i).getAttribute("data-program")=="AmexPoints" shouldBe(false)
}
自动化代码在页面上进行上述验证,但是页面是internal error,没有"points-program-option"这个元素,自动化代码应该报错,但实际上代码跑过了,
我试过webDriver.findElement(By.className("points-program-option")),自动化代码会因为找不到元素而报错,不知道为什么?

第1个回答  2020-03-09