The following code sends output to the console when the expression fails even though the try()
argument silent = TRUE
.
dd = try(unlist(remDr$findElement("css", "#ctl00_mainA")), silent = TRUE)
suppressMessages()
does not suppress the output.
dd = suppressMessages(try(unlist(remDr$findElement("css", "#ctl00_mainA")), silent = TRUE))
try() is used to trap the error Selenium message: Unable to locate element: ........
. The code logic works perfectly; the script continues to run as intended.
The message is not an Error that appears in red. The message is in black; the same color that results from print() and cat().
Echo is off. The source code does not print to the console.
I want to suppress the message while retaining the ability to send messages to the console with print() and cat().
Would appreciate any ideas.