before using selenium, you could use something like:
public static boolean linkExists(String URLName){
try {
HttpURLConnection.setFollowRedirects(false);
HttpURLConnection con =
(HttpURLConnection) new URL(URLName).openConnection();
con.setRequestMethod("HEAD");
return (con.getResponseCode() == HttpURLConnection.HTTP_OK);
}
catch (Exception e) {
e.printStackTrace();
return false;
}
}
Using it in this way:
WebDriver driver = new FirefoxDriver();
for(String url : csvArray){
if(linkExists(url)){
driver.get(url);
.
.
.
}
}