chore: добавлена возможность передавать локатор для выбора элемента сигнализирующего о странице антибот защиты

This commit is contained in:
protokey committed 2026-09-18 16:21:07 +04:00
1 parent 6124c604d9
commit ce68d2727c
7 files changed
+36 -11

No files matched your search

+15 -6
View File
@@ -65,28 +65,37 @@ async def wait_for(page: Page, act: ActionRequest, **kwargs) -> str | None:
@register
async def pass_challenge(page: Page, act: ActionRequest, *, antibot_name, success_locator = None, captcha_key= None, **kwargs) -> str | None:
assert act.selector
async def pass_challenge(
page: Page, act: ActionRequest, *,
antibot_name, success_locator=None, captcha_key=None, detect_locator=None,
**kwargs
) -> str | None:
await pass_challenges(
antibot_name, page,
captcha=captcha_key, success_locator=act.selector
captcha=captcha_key,
success_locator=act.selector or success_locator,
detect_locator=detect_locator
)
async def execute(
page: Page, actions: list[ActionRequest],
captcha_key: str | None = None, antibot_name: str | None = None,
success_locator: str | None = None) -> list[dict]:
success_locator: str | None = None,
detect_locator: str | None = None) -> list[dict]:
"""Выполнение очереди автоматизации"""
actions_result = []
ctx = {
"captcha_key": captcha_key,
"antibot_name": antibot_name,
"success_locator": success_locator
"success_locator": success_locator,
"detect_locator": detect_locator,
}
await pass_challenges(
antibot_name, page,
captcha=captcha, success_locator=success_locator
captcha=captcha_key,
success_locator=success_locator,
detect_locator=detect_locator,
)
for act in actions:
new_line = {
+1
View File
@@ -32,5 +32,6 @@ class SolveRequest(BaseModel):
# TODO: screenshot: bool = False
captcha: str | None = None
captcha_detect_locator: str | None = None
captcha_success_locator: str | None = None
captcha_type: str | None = None