fix: ложный status ok и падение без captcha_type
- без captcha_type шаг антибота пропускается, на неизвестный тип — понятная ошибка - wait_for и pass_challenge при неудаче падают, а не возвращают текст ошибки как результат - status "err" ставится по упавшему действию (раньше проверялся несуществующий ключ error) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c54500b178
commit
df108dae3f
4 files changed
+13
-8
No files matched your search
+3
-4
@@ -74,10 +74,7 @@ async def inner_html(page: Page, act: ActionRequest, **kwargs) -> str | None:
|
||||
async def wait_for(page: Page, act: ActionRequest, **kwargs) -> str | None:
|
||||
assert act.selector
|
||||
assert 1 <= act.timeout <= 7200
|
||||
try:
|
||||
await page.wait_for_selector(act.selector, timeout=act.timeout * 1000)
|
||||
except Exception as e:
|
||||
return str(e)
|
||||
await page.wait_for_selector(act.selector, timeout=act.timeout * 1000)
|
||||
|
||||
|
||||
@register
|
||||
@@ -92,6 +89,8 @@ async def pass_challenge(
|
||||
success_locator=act.selector or success_locator,
|
||||
detect_locator=detect_locator
|
||||
)
|
||||
if not result.cleared:
|
||||
raise Exception(f"challenge not passed: {result.reason}")
|
||||
return result.reason
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user