以下のコードを見つけてください。
public static void selectDefinition(String defName)
{
driver.findElement(By.xpath("//table[@id='MainContent_gdvDefs_DXMainTable']//td[text()='"+defName+"']")).click();
}
と
try{
selectDefinition(defdelname);
System.out.println("Definition "+defdelname+" was not removed from the table");
}
catch (Exception ex)
{
System.out.println("Definition "+defdelname+"was removed successfully from the table");
}
上記のコードでは、「defdelname」が削除された場合、catch ブロックは実行されませんが、selectDefinition ではそのような要素の例外はスローされません。
私は初心者です pls は私を助けてくれます... この問題を解決するには、catch ブロックを実行したいのですが、そのための回避策はありますか?