A - After completing the form on Page 1, sometimes there’s a popup that says “Thank you for answering the survey!” (with an “OK” button to close the popup) if the account has not yet registered with the site yet. If you click on the OK button, it redirects you to the profile page.
B - After completing the form on Page 1 and the site detects that the email is already registered, it skips the popup and goes straight to the profile page.
How can I make Puppeteer detect Sceneario A first? If there’s no popup, then proceed to the next step? I realized I cannot do Wait For Element since both scenarios wouldn’t necessarily have the popup buttons.
I’m hoping for something like:
“If button present, click button, proceed to step 3”
“If button is not present, proceed to step 3”