(payload = {})
| 1757 | } |
| 1758 | |
| 1759 | async function step8_triggerContinue(payload = {}) { |
| 1760 | const strategy = payload?.strategy || 'requestSubmit'; |
| 1761 | const continueBtn = await prepareStep8ContinueButton({ |
| 1762 | findTimeoutMs: payload?.findTimeoutMs, |
| 1763 | enabledTimeoutMs: payload?.enabledTimeoutMs, |
| 1764 | }); |
| 1765 | const form = continueBtn.form || continueBtn.closest('form'); |
| 1766 | |
| 1767 | switch (strategy) { |
| 1768 | case 'requestSubmit': |
| 1769 | if (!form || typeof form.requestSubmit !== 'function') { |
| 1770 | throw new Error('“继续”按钮当前不在可提交的 form 中,无法使用 requestSubmit。URL: ' + location.href); |
| 1771 | } |
| 1772 | form.requestSubmit(continueBtn); |
| 1773 | break; |
| 1774 | case 'nativeClick': |
| 1775 | continueBtn.click(); |
| 1776 | break; |
| 1777 | case 'dispatchClick': |
| 1778 | simulateClick(continueBtn); |
| 1779 | break; |
| 1780 | default: |
| 1781 | throw new Error(`未知的 Step 8 触发策略:${strategy}`); |
| 1782 | } |
| 1783 | |
| 1784 | log(`Step 8: continue button triggered via ${strategy}.`); |
| 1785 | return { |
| 1786 | strategy, |
| 1787 | ...getStep8State(), |
| 1788 | }; |
| 1789 | } |
| 1790 | |
| 1791 | async function prepareStep8ContinueButton(options = {}) { |
| 1792 | const { |
no test coverage detected