VerifyElementPresent behaves unlike expected

Hello everyone,

I am currently using the “VerifyElementPresent” Command to check for the existence of the next row within a table. If the next row doesn’t exist the macro is supposed to click a “close” button and do the same thing with the next table (The macro loops through a list of tables which each get scraped row by row).

Recently I’ve been having problems with the macro “forgetting” to click the close button and reading the same table over and over. After looking for a while I found the culprit in the strange behavior of “VerifyElementPresent” Command. Usually the command looks for an element and if not found it outputs this to log:
2023-04-12T13:46:49.085Z - [info] Executing: | verifyElementPresent | /html[1]/body[1]/div[2]/div[1]/main[1]/div[1]/div[1]/div[5]/div[2]/div[1]/div[1]/div[1]/div[1]/div[${i}]/div[1] | |
2023-04-12T13:47:08.653Z - [error][ignored] ‘/html[1]/body[1]/div[2]/div[1]/main[1]/div[1]/div[1]/div[5]/div[2]/div[1]/div[1]/div[1]/div[1]/div[53]/div[1]’ element not present

This is when its working as intented. I noticed that each time my macro got stuck this was the preceding output:
2023-04-12T13:48:28.208Z - [info] Executing: | verifyElementPresent | /html[1]/body[1]/div[2]/div[1]/main[1]/div[1]/div[1]/div[5]/div[2]/div[1]/div[1]/div[1]/div[1]/div[${i}]/div[1] | |
2023-04-12T13:48:48.291Z - [error][ignored] timeout reached when looking for element ‘/html[1]/body[1]/div[2]/div[1]/main[1]/div[1]/div[1]/div[5]/div[2]/div[1]/div[1]/div[1]/div[1]/div[52]/div[1]’

As visible there are 2 ways for the command to respond to an nonexistent element. Why are there 2 different responses for the command when it doesnt find an element and how do I prevent the wrong one from occuring? I have already increased the timeoutWait to 20 seconds which is already slowing the macro down by a lot.