From 8fca42193ad59418d3ef6b2c62f81a2cccba8e87 Mon Sep 17 00:00:00 2001 From: Nick Shirokov Date: Mon, 16 Mar 2026 12:36:38 +0300 Subject: [PATCH] =?UTF-8?q?feat(web-test):=20readTable/getFormState=20?= =?UTF-8?q?=E2=80=94=20expose=20unnamed=20checkbox=20columns?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Unnamed checkbox columns (no header text) now appear as "(checkbox)" in getFormState().tables[].columns and readTable().columns. Checkbox cell values return "true"/"false" instead of empty strings. Co-Authored-By: Claude Opus 4.6 (1M context) --- .claude/skills/web-test/scripts/dom.mjs | 40 ++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/.claude/skills/web-test/scripts/dom.mjs b/.claude/skills/web-test/scripts/dom.mjs index d5951f4e..d352a55e 100644 --- a/.claude/skills/web-test/scripts/dom.mjs +++ b/.claude/skills/web-test/scripts/dom.mjs @@ -200,7 +200,20 @@ const READ_FORM_FN = `function readForm(p) { if (box.offsetWidth === 0) return; const textEl = box.querySelector('.gridBoxText'); const text = (textEl || box).innerText?.trim().replace(/\\n/g, ' ') || ''; - if (text) columns.push(text); + if (text) { + columns.push(text); + } else { + // Unnamed column — check if data cells contain checkboxes + const firstLine = body?.querySelector('.gridLine'); + if (firstLine) { + const visibleHeaders = [...headLine.children].filter(c => c.offsetWidth > 0); + const idx = visibleHeaders.indexOf(box); + const cells = [...firstLine.children].filter(c => c.offsetWidth > 0); + if (cells[idx]?.querySelector('.checkbox')) { + columns.push('(checkbox)'); + } + } + } }); } const rowCount = body ? body.querySelectorAll('.gridLine').length : 0; @@ -483,7 +496,20 @@ export function readTableScript(formNum, { maxRows = 20, offset = 0, gridSelecto if (box.offsetWidth === 0) return; const textEl = box.querySelector('.gridBoxText'); const text = (textEl || box).innerText?.trim().replace(/\\n/g, ' ') || ''; - if (!text) return; + if (!text) { + // Unnamed column — check if data cells contain checkboxes + const firstLine = body?.querySelector('.gridLine'); + if (firstLine) { + const visibleHeaders = [...headLine.children].filter(c => c.offsetWidth > 0); + const idx = visibleHeaders.indexOf(box); + const cells = [...firstLine.children].filter(c => c.offsetWidth > 0); + if (cells[idx]?.querySelector('.checkbox')) { + const r = box.getBoundingClientRect(); + columns.push({ text: '(checkbox)', x: r.x, w: r.width, right: r.x + r.width }); + } + } + return; + } const r = box.getBoundingClientRect(); columns.push({ text, x: r.x, w: r.width, right: r.x + r.width }); }); @@ -501,8 +527,14 @@ export function readTableScript(formNum, { maxRows = 20, offset = 0, gridSelecto [...line.children].forEach(box => { if (box.offsetWidth === 0) return; const textEl = box.querySelector('.gridBoxText'); - const val = (textEl || box).innerText?.trim().replace(/\\n/g, ' ') || ''; - if (!val) return; + const chk = box.querySelector('.checkbox'); + let val; + if (chk) { + val = chk.classList.contains('select') ? 'true' : 'false'; + } else { + val = (textEl || box).innerText?.trim().replace(/\\n/g, ' ') || ''; + if (!val) return; + } // Match cell to column by X-coordinate overlap const r = box.getBoundingClientRect(); const cx = r.x + r.width / 2;