我正在自动化一个场景,例如 - 将字符串传递到编辑框,如果字符串在 DB 中可用,则从建议列表中选择现有数据。如果没有,请点击新建按钮。 因此,我正在尝试这样做。
Test_Tag.sendKeys("Test");
try {
if(tags_Suggestion_list.isDisplayed()){
tags_Suggestion_list.click();
System.out.println("try");
}
} catch(Exception e) {
System.out.println("catch");
create_New_Tag.click();
System.out.println("new");
waitForElementToBeVisible(create_Tag_PopUp);
save_Tag_Btn.click();
System.out.println("catch done");
}
所以如果有任何其他方法来处理这种情况,请在这里帮助我。