channel-worker 2.5.31 → 2.5.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/scripts/warmup_facebook.js +14 -2
package/package.json
CHANGED
|
@@ -140,8 +140,20 @@ async function focusFbSearch(page, log) {
|
|
|
140
140
|
if (box) {
|
|
141
141
|
try {
|
|
142
142
|
await box.click({ timeout: 2500 });
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
// CLEAR the previous keyword first. FB's search is a React-controlled
|
|
144
|
+
// input — Ctrl+A+Backspace didn't reset its value (keywords appended:
|
|
145
|
+
// "kw1kw2"). locator.fill('') dispatches the input events React needs,
|
|
146
|
+
// reliably emptying it; verify + fall back to mass-Backspace.
|
|
147
|
+
await box.fill('').catch(() => {});
|
|
148
|
+
let cur = await box.evaluate(el => (el.value != null ? el.value : (el.textContent || ''))).catch(() => '');
|
|
149
|
+
if (cur && cur.trim()) {
|
|
150
|
+
await page.keyboard.press('End').catch(() => {});
|
|
151
|
+
for (let i = 0; i < cur.length + 8; i++) await page.keyboard.press('Backspace').catch(() => {});
|
|
152
|
+
cur = await box.evaluate(el => (el.value != null ? el.value : (el.textContent || ''))).catch(() => '');
|
|
153
|
+
}
|
|
154
|
+
if (cur && cur.trim()) { log('info', `[warmup-fb] search box not fully cleared (still "${cur.slice(0, 20)}") — typing anyway`); }
|
|
155
|
+
// Re-focus so the subsequent human-typing lands in the box.
|
|
156
|
+
await box.click({ timeout: 2000 }).catch(() => {});
|
|
145
157
|
return true;
|
|
146
158
|
} catch {}
|
|
147
159
|
}
|