Code that should catch page loading status
public static int getResponseCode(String urlString) throws IOException { URL url = new URL(urlString); HttpURLConnection huc = (HttpURLConnection)url.openConnection(); huc.setRequestMethod("GET"); huc.connect(); return huc.getResponseCode();} private static int statusCode; The cycle in which I check the status of the pages
for(int i = 0; i < url.length; i++) {try {driver.get(url[i]); driver.manage().timeouts().pageLoadTimeout(60, TimeUnit.SECONDS); statusCode = getResponseCode(url[i]); if(statusCode >= 300){System.out.println("HTTP code "+statusCode+" on "+url[i]);} else {System.out.println("Code is "+statusCode);}} catch (Exception e){System.out.println("Exception. Probably 50X");}} I use catch (Exception e) because I can’t catch 500e loading statuses, can I do something wrong?