I wondering it is the way to check in tryCatch function kind of errors or warnings like in Java for example.
try {
driver.findElement(By.xpath(locator)).click();
result= true;
} catch (Exception e) {
if(e.getMessage().contains("is not clickable at point")) {
System.out.println(driver.findElement(By.xpath(locator)).getAttribute("name")+" are not clicable");
} else {
System.err.println(e.getMessage());
}
} finally {
break;
}
In R I only find solution for handling all error in one ways, example
result = tryCatch({
expr
}, warning = function(w) {
warning-handler-code
}, error = function(e) {
error-handler-code
}, finally = {
cleanup-code
}
tryCatch
and I've noticed that a closing parenthesis is missing in the end of your second example. (I cannot edit your post to change only one character, so I leave it as a comment. This comment can be deleted afterwards.) – Plainsman