【发布时间】:2021-02-12 11:25:31
【问题描述】:
下面的代码抛出'stale element reference: element is not attach to the page document'
如何处理错误信息并将结果显示为通过
Action- 下面的代码是在另一张图片中添加一张图片(可以是一张或多张)
public void click_on_the_Add_to_collection_button_displaying_down_below_the_assert() {
List<WebElement> all_colection = driver.findElements(By.xpath("//li//button[@class='icon-button ' and @title='Add To Collection']"));
int collection_size = all_colection.size();
System.out.println("the collection size is " + collection_size);
Random ran = new Random();
all_colection.get(collection_size - 1).click();
crate_new_colection.sendKeys("newcollection#1");
}
【问题讨论】: