If page.waitForSelector()
fails, it throws an error. Since this is run inside an async function if leads straight to the catch portion of the code.
Is there a chance that if page.waitForSelector()
fails, code is executed one line below?
Like this (pseudocode):
if ( (await page.waitForSelector('.test') == null) { //do X}
From the API:
If the selector doesn't appear after the timeout milliseconds of waiting, the function will throw.
How do i manage that throw in the same block of code, as if the fucntion would succeed?