How to get required output from the java code for SDK Concept

List links = driver.findElements(By.tagName(“a”));
for(int i=0; i<links.size(); i++) {
WebElement element = links.get(i);
String url=element.getAttribute(“href”);
try {
URL link = new URL(url);
HttpURLConnection httpConn =(HttpURLConnection)link.openConnection();
httpConn.setConnectTimeout(2000);
httpConn.connect();
if(httpConn.getResponseCode()== 404) {
String BrLink = url.concat("
");
System.out.println(url);
}
}
catch (Exception e) {
//e.printStackTrace();
}
}

Test Project converted “driver.findElements(By.tagName(“a”)” to one step and element.getAttribute(“href”) as mutliple steps with output showing the links. I need to take broken links as output (BrLink).

Hello @saravanan.munikrishn, and welcome to our community!
To turn off automatic reporting you can follow this guide:

and manually add report message for the steps you want to report: