I am parsing using .visit () with this code:
String link = "Aquí iría la URL";
Document doc = ScrapingUtils.visit(link, false);
The fact is that sometimes for whatever reason you can not access the page, and you send me a error time out . I would like to collect when this happens in order to give a concrete value to the variables in which the elements I am extracting are stored, but I can not find the form.
After that code I only have one conditional if such that:
if (doc != null) {
//código
else {
//código
}
The only thing I can think of is with a try / catch just before the conditional. That is:
String link = "Aquí iría la URL";
Document doc = ScrapingUtils.visit(link, false);
try {
if (doc != null) {
//código
else {
//código
}
catch () {
}