Fix pressSequentially -> type() and extend submit polling to ~15s
Playwright on AWS doesn't have pressSequentially, use type() instead. Extend submit polling from 4 to 6 iterations (~15s total) to handle slower reCAPTCHA verification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -154,8 +154,8 @@ async function fillAndSubmit(page, job, formFiller, meta, opts) {
|
|||||||
// (invisible reCAPTCHA + server round-trip can take several seconds)
|
// (invisible reCAPTCHA + server round-trip can take several seconds)
|
||||||
const verifySelector = opts.verifySelector || 'form button[type="submit"]:not([disabled])';
|
const verifySelector = opts.verifySelector || 'form button[type="submit"]:not([disabled])';
|
||||||
let postSubmit = { hasSuccess: false, hasForm: true, validationErrors: [] };
|
let postSubmit = { hasSuccess: false, hasForm: true, validationErrors: [] };
|
||||||
for (let wait = 0; wait < 4; wait++) {
|
for (let wait = 0; wait < 6; wait++) {
|
||||||
await page.waitForTimeout(wait === 0 ? SUBMIT_WAIT : 2000);
|
await page.waitForTimeout(wait === 0 ? SUBMIT_WAIT : 2500);
|
||||||
postSubmit = await page.evaluate((vs) => {
|
postSubmit = await page.evaluate((vs) => {
|
||||||
const text = (document.body.innerText || '').toLowerCase();
|
const text = (document.body.innerText || '').toLowerCase();
|
||||||
const errorEls = document.querySelectorAll('[class*="error"], [class*="invalid"], [role="alert"]');
|
const errorEls = document.querySelectorAll('[class*="error"], [class*="invalid"], [role="alert"]');
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ export async function apply(page, job, formFiller) {
|
|||||||
|
|
||||||
await el.click();
|
await el.click();
|
||||||
await el.evaluate(e => { e.value = ''; });
|
await el.evaluate(e => { e.value = ''; });
|
||||||
await el.pressSequentially(value, { delay: 30 });
|
await el.type(value, { delay: 30 });
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
const option = await page.$(`[id*="react-select-${id}-option"]`);
|
const option = await page.$(`[id*="react-select-${id}-option"]`);
|
||||||
if (option) {
|
if (option) {
|
||||||
|
|||||||
Reference in New Issue
Block a user