fix: gracefully skip invalid pressKey values in QA recording

Instead of crashing the entire recording session when Gemini generates
an invalid key name (e.g. "mouseWheelDown"), catch the error and
continue with remaining steps.
This commit is contained in:
snomiao
2026-03-21 05:46:06 +00:00
parent 989a6f551a
commit 61c32dafba

View File

@@ -357,8 +357,14 @@ async function executeSteps(
await fillDialogAndConfirm(page, step.text)
break
case 'pressKey':
await page.keyboard.press(step.key)
await sleep(300)
try {
await page.keyboard.press(step.key)
await sleep(300)
} catch (e) {
console.warn(
`Skipping invalid key "${step.key}": ${e instanceof Error ? e.message : e}`
)
}
break
case 'click':
await clickByText(page, step.text)