Implement a global listener for Selenium tests
not sure about your specific situation but in vba I would write an if statement to see if it was true,
If driver.findelementsbyid("your Id").count > 0 thendriver.findelementbyid("your Id").clickElseEnd if
Searching if the element exists should help you
WebElement elementName = driver.findElement(By.id("idElement")); if(elementName != null){ //Loaded Element }