I'm trying to check if an element exists before I can execute this line:
driver.findElement(webdriver.By.id('test'));
This throws an error "no such element" if the id test
doesn't exist in the document, even in a try
-block.
I've found answers for Java, where you can check if the size is 0, but in node-js this throws an error before I can check the size.
throw error;
^
NoSuchElementError: no such element