I want to use Except TimeoutError to handle the timeout problem. But the script always throws me a TimeoutError, not print a message as I planed.
Here is my code:
try:
    await page.wait_for_selector("#winiframe_main", timeout=10000, state='detached')
    print("The frame is detached.")
except TimeoutError:
    print("The frame is not detached")
Is there anything wrong with my code?
 
     
    