I am losing my MIND, please help an idiot

Ok, I’m admittedly like 14% sure I know what I’m doing. I tried to create a macro that will basically scrape a series of websites of competition for a retailer I work for, find their deal and promos, and pop that into a CSV where I can clean it up with ai. However, I’ve been wrestling for hours trying to get it to work and I’m at my wits end. Could anybody be kind enough to help me troubleshoot?

{
  "Name": "Promo_Puller_NoExample (header skip, one tab)",
  "CreationDate": "2025-11-07",
  "Commands": [
    { "Command": "store", "Target": "false", "Value": "!errorignore" },
    { "Command": "store", "Target": "60", "Value": "!TIMEOUT_PAGELOAD" },
    { "Command": "store", "Target": "12", "Value": "!TIMEOUT_WAIT" },

    { "Command": "store", "Target": "age_gate_entry.csv", "Value": "srcCsv" },

    { "Command": "csvRead", "Target": "${srcCsv}", "Value": "" },
    { "Command": "csvRead", "Target": "${srcCsv}", "Value": "" },

    { "Command": "store", "Target": "URL,Method,ExtractedText", "Value": "!csvLine" },
    { "Command": "csvSave", "Target": "promos_this_week_raw.csv", "Value": "" },

    { "Command": "while", "Target": "${!csvReadStatus} == 'OK'", "Value": "" },

    { "Command": "store", "Target": "${!COL1}", "Value": "page_url_raw" },

    { "Command": "store", "Target": "true", "Value": "!errorignore" },
    { "Command": "store", "Target": "${!COL2}", "Value": "age_selector" },
    { "Command": "store", "Target": "false", "Value": "!errorignore" },

    {
      "Command": "executeScript_Sandbox",
      "Target": "var u='${page_url_raw}'||''; u=u.trim(); if(u.toLowerCase()==='url'||u.toLowerCase().startsWith('url,')){u='';} if(u.length>0){var a=u.charCodeAt(0); if(a===34||a===39){u=u.substring(1);} } if(u.length>0){var b=u.charCodeAt(u.length-1); if(b===34||b===39){u=u.substring(0,u.length-1);} } if(u && !/^https?:\\/\\//i.test(u)){u='https://'+u;} return u;",
      "Value": "page_url"
    },

    { "Command": "if", "Target": "${page_url} != ''", "Value": "" },

      { "Command": "open", "Target": "${page_url}", "Value": "" },
      { "Command": "waitForElementVisible", "Target": "xpath=//body", "Value": "" },

      { "Command": "store", "Target": "false", "Value": "age_done" },

      { "Command": "if", "Target": "${age_selector} != ''", "Value": "" },
        { "Command": "verifyElementPresent", "Target": "${age_selector}", "Value": "" },
        { "Command": "if", "Target": "${!LastCommandOK} == true", "Value": "" },
          { "Command": "click", "Target": "${age_selector}", "Value": "" },
          { "Command": "waitForElementVisible", "Target": "xpath=//body", "Value": "" },
          { "Command": "store", "Target": "true", "Value": "age_done" },
        { "Command": "end", "Target": "", "Value": "" },
      { "Command": "end", "Target": "", "Value": "" },

      { "Command": "if", "Target": "${age_done} == false", "Value": "" },
        { "Command": "verifyElementPresent", "Target": "xpath=(//button[contains(.,'21') or contains(.,'Enter') or contains(.,'Yes')] | //a[contains(.,'Enter') or contains(.,'Yes')] | //div[@role='button'][contains(.,'Enter')])[1]", "Value": "" },
        { "Command": "if", "Target": "${!LastCommandOK} == true", "Value": "" },
          { "Command": "click", "Target": "xpath=(//button[contains(.,'21') or contains(.,'Enter') or contains(.,'Yes')] | //a[contains(.,'Enter') or contains(.,'Yes')] | //div[@role='button'][contains(.,'Enter')])[1]", "Value": "" },
          { "Command": "waitForElementVisible", "Target": "xpath=//body", "Value": "" },
          { "Command": "store", "Target": "true", "Value": "age_done" },
        { "Command": "end", "Target": "", "Value": "" },
      { "Command": "end", "Target": "", "Value": "" },

      { "Command": "if", "Target": "${age_done} == false", "Value": "" },
        { "Command": "verifyElementPresent", "Target": "xpath=//iframe", "Value": "" },
        { "Command": "if", "Target": "${!LastCommandOK} == true", "Value": "" },
          { "Command": "selectFrame", "Target": "index=0", "Value": "" },
          { "Command": "verifyElementPresent", "Target": "xpath=(//button[contains(.,'21') or contains(.,'Enter') or contains(.,'Yes')] | //a[contains(.,'Enter') or contains(.,'Yes')] | //div[@role='button'][contains(.,'Enter')])[1]", "Value": "" },
          { "Command": "if", "Target": "${!LastCommandOK} == true", "Value": "" },
            { "Command": "click", "Target": "xpath=(//button[contains(.,'21') or contains(.,'Enter') or contains(.,'Yes')] | //a[contains(.,'Enter') or contains(.,'Yes')] | //div[@role='button'][contains(.,'Enter')])[1]", "Value": "" },
            { "Command": "waitForElementVisible", "Target": "xpath=//body", "Value": "" },
            { "Command": "store", "Target": "true", "Value": "age_done" },
          { "Command": "end", "Target": "", "Value": "" },
          { "Command": "selectFrame", "Target": "relative=top", "Value": "" },
        { "Command": "end", "Target": "", "Value": "" },
      { "Command": "end", "Target": "", "Value": "" },

      { "Command": "store", "Target": "", "Value": "extracted_method" },
      { "Command": "store", "Target": "", "Value": "extracted_text" },

      { "Command": "storeText", "Target": "xpath=//body", "Value": "extracted_text" },
      { "Command": "executeScript_Sandbox", "Target": "var s='${extracted_text}'||''; s=s.replace(/\\r?\\n+/g,' ').replace(/\\s{2,}/g,' ').trim(); return s;", "Value": "extracted_text" },
      { "Command": "if", "Target": "${extracted_text} != ''", "Value": "" },
        { "Command": "store", "Target": "HTML", "Value": "extracted_method" },
      { "Command": "end", "Target": "", "Value": "" },

      { "Command": "if", "Target": "${extracted_text} == ''", "Value": "" },
        { "Command": "captureEntirePageScreenshot", "Target": "${!NOW}.png", "Value": "" },
        { "Command": "OCRExtractScreenshot", "Target": "", "Value": "_ocr" },
        { "Command": "executeScript_Sandbox", "Target": "var s='${_ocr}'||''; s=s.replace(/\\r?\\n+/g,' ').replace(/\\s{2,}/g,' ').replace(/,/g,';').trim(); return s;", "Value": "extracted_text" },
        { "Command": "store", "Target": "OCR", "Value": "extracted_method" },
      { "Command": "end", "Target": "", "Value": "" },

      { "Command": "executeScript_Sandbox", "Target": "var s='${extracted_text}'||''; s=s.replace(/,/g,';'); return s;", "Value": "extracted_text" },
      { "Command": "store", "Target": "${page_url},${extracted_method},${extracted_text}", "Value": "!csvLine" },
      { "Command": "csvSave", "Target": "promos_this_week_raw.csv", "Value": "" },

    { "Command": "end", "Target": "", "Value": "" },

    { "Command": "csvRead", "Target": "${srcCsv}", "Value": "" },

    { "Command": "end", "Target": "", "Value": "" },

    { "Command": "localStorageExport", "Target": "promos_this_week_raw.csv", "Value": "promos_this_week_raw.csv" }
  ]
}

My CSV has two columns, column A being URL and column B being AgeSelector, as most websites for my industry (cannabis) are age gated, so I need to ensure those age gated bits get clicked and dismissed.

I think the big issue is that it’s failing to pull my URLs from the CSV but no idea why!

Just to clarify: The issue is reading a URL from the CSV file? Is all other data read ok?