mirror of
https://github.com/LightZirconite/Microsoft-Rewards-Bot.git
synced 2026-01-17 20:23:56 +00:00
fix: Improve activity management by replacing fixed delay with fast failure for unavailable activities
This commit is contained in:
@@ -134,9 +134,7 @@ export async function waitForElementSmart(
|
||||
return { found: true, timeMs: elapsed, element }
|
||||
|
||||
} catch (firstError) {
|
||||
// Element not found quickly - try extended wait
|
||||
logFn('Element not immediate, extending timeout...')
|
||||
|
||||
// Element not found quickly - try extended wait (silent until result known)
|
||||
try {
|
||||
const element = page.locator(selector)
|
||||
await element.waitFor({ state, timeout: extendedTimeoutMs })
|
||||
@@ -147,8 +145,8 @@ export async function waitForElementSmart(
|
||||
|
||||
} catch (extendedError) {
|
||||
const elapsed = Date.now() - startTime
|
||||
const errorMsg = extendedError instanceof Error ? extendedError.message : String(extendedError)
|
||||
logFn(`✗ Element not found after ${elapsed}ms: ${errorMsg}`)
|
||||
// IMPROVED: Concise failure message without full Playwright error stack
|
||||
logFn(`Element not found after ${elapsed}ms (expected if activity unavailable)`)
|
||||
return { found: false, timeMs: elapsed, element: null }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user