测试基于CEF的单页应用程序,并有一些问题。因此,我的应用程序可以生成许多不同配置的输出文件,这些配置可以根据彼此的下拉列表进行选择。
尝试通过模拟适当的单击为所有可能的选项生成文件: display list select the first possible -> same with list2 -> same with list3 all -> go forward -> export file -> go back to again。
for (WebElement material : materialList) {
displayMaterialList.click();
material.click();
for (WebElement size : sizeList) {
displaySizeList.click();
size.click();
for (WebElement thickness : thicknessList) {
displayThicknessList.click();
thickness.click();
//Exporting file:
nextStepButton.click()
nextStepButton.click();
exportFileButton.click();
copyPasteText("filename" + "_" + currentDataTime);
previousStepButton.click();;
}
}
}这些循环运行良好,无需导出嵌入在最深循环中的文件片段,使用它们来显示所有可能选项的组合。但是,当我添加文件命名和导出片段测试项目时,在第二次迭代开始时,就在生成文件之后抛出了StaleElementReferenceException。我想它找不到thickness.click();,但不知道为什么。
发布于 2020-10-19 21:56:47
常见原因
陈旧的元素引用异常在两种情况中的一种抛出,第一种比第二种更常见:
The element has been deleted entirely.
The element is no longer attached to the DOM.请检查这一点,如果看不到您正在尝试测试的html tha,请给出一个适当的答案。
https://stackoverflow.com/questions/64428406
复制相似问题