mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-15 23:35:17 +03:00
fix(web-test): pass table scope to highlight in clickElement
highlight() was ignoring the table parameter, always highlighting the
first matching button (e.g. "Добавить" for Входящие instead of
Исходящие). Now clickElement passes { table } to highlight, and
highlight pre-resolves the grid via resolveGridScript to pass
gridSelector to findClickTargetScript — same pattern as clickElement
itself.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1444,7 +1444,7 @@ export async function fillFields(fields) {
|
|||||||
export async function clickElement(text, { dblclick, table } = {}) {
|
export async function clickElement(text, { dblclick, table } = {}) {
|
||||||
ensureConnected();
|
ensureConnected();
|
||||||
await dismissPendingErrors();
|
await dismissPendingErrors();
|
||||||
if (highlightMode) try { await highlight(text); await page.waitForTimeout(500); await unhighlight(); } catch {}
|
if (highlightMode) try { await highlight(text, { table }); await page.waitForTimeout(500); await unhighlight(); } catch {}
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// First check if there's a confirmation dialog — click matching button
|
// First check if there's a confirmation dialog — click matching button
|
||||||
@@ -4012,7 +4012,7 @@ export async function hideTitleSlide() {
|
|||||||
*/
|
*/
|
||||||
export async function highlight(text, opts = {}) {
|
export async function highlight(text, opts = {}) {
|
||||||
ensureConnected();
|
ensureConnected();
|
||||||
const { color = '#e74c3c', padding = 4 } = opts;
|
const { color = '#e74c3c', padding = 4, table } = opts;
|
||||||
|
|
||||||
// Remove previous highlight first
|
// Remove previous highlight first
|
||||||
await unhighlight();
|
await unhighlight();
|
||||||
@@ -4108,7 +4108,12 @@ export async function highlight(text, opts = {}) {
|
|||||||
const formNum = await page.evaluate(detectFormScript());
|
const formNum = await page.evaluate(detectFormScript());
|
||||||
if (formNum !== null) {
|
if (formNum !== null) {
|
||||||
// 3a. Try button/link/tab/gridRow via findClickTargetScript
|
// 3a. Try button/link/tab/gridRow via findClickTargetScript
|
||||||
const target = await page.evaluate(findClickTargetScript(formNum, text));
|
let gridSelector;
|
||||||
|
if (table) {
|
||||||
|
const resolved = await page.evaluate(resolveGridScript(formNum, table));
|
||||||
|
if (!resolved.error) gridSelector = resolved.gridSelector;
|
||||||
|
}
|
||||||
|
const target = await page.evaluate(findClickTargetScript(formNum, text, table ? { tableName: table, gridSelector } : undefined));
|
||||||
if (target && !target.error) {
|
if (target && !target.error) {
|
||||||
if (target.id) {
|
if (target.id) {
|
||||||
elId = target.id;
|
elId = target.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user