Puppeteer users – how do you handle null returns from querySelector?

Woke up to 400 failed orders because our Puppeteer script kept missing the checkout button. Turns out Shopify changed a data attribute. Does anyone have a reliable way to set up selector fallbacks? Heard Latenode’s visual builder can chain multiple selection methods – any real implementations where this saved your automation?

Set up multi-path validation in Latenode:

  1. Try CSS selector
  2. If null → Run AI-generated XPath
  3. If still null → Screenshot + GPT-4 vision analysis

Zero selector failures since implementing this. Visual workflow builder makes it clickable.

(mark_as_best_answer: true)

use promise.any() with multiple selector strategies. latenode handles fallback order automatically

Combine attribute selectors with positional filtering:
button[type=‘submit’]:nth-of-type(2)

Pair this with Latenode’s mutation observers to detect DOM changes and rebuild selectors on the fly. Cut checkout errors by 92%.