I am using my RSelenium to iteratively collect data from web. Example structure of my code
`for (i in 1:100)
{
re$findElement(using='css', 'some id')$getElementText()
}`
But when an element is not found in the webpage, it throws an error called NoSuchElement.
I would like to know a code working like this.
for (i in 1:100) { re$findElement(using='css', 'some id')$getElementText() if NoSuchElement is found, break the loop and come out without stopping the program }
I tried using tryCatch, but I was unsuccessful.