java - I want to print the URL with the response status but only the total count is printing after that not even getting a error message -
i want print url response status total count printing after not getting error message
{ list<webelement> links=driver.findelements(by.linktext("webshop")); system.out.println("total uat webshop links " + links.size()); for(int i=0;i<links.size();i++) { webelement ele = links.get(i); string url = ele.getattribute("href"); verifylinkactive(url); } } public static void verifylinkactive(string linkurl) { try { url url = new url(linkurl); httpurlconnection httpurlconnect = (httpurlconnection)url.openconnection(); httpurlconnect.connect(); if (httpurlconnect.getresponsecode() == 200) { system.out.println(linkurl + " - " + httpurlconnect.getresponsemessage()); } if (httpurlconnect.getresponsecode() == httpurlconnection.http_not_found) { system.out.println(linkurl + " - " + httpurlconnect.getresponsemessage() + " - " + httpurlconnection.http_not_found); } } catch (exception e) { } }
Comments
Post a Comment