general text captcha solution (#4517)
This commit is contained in:
@@ -12,6 +12,16 @@ LOG = structlog.get_logger()
|
||||
T = TypeVar("T", bound="Action")
|
||||
|
||||
|
||||
class CaptchaType(StrEnum):
|
||||
TEXT_CAPTCHA = "text_captcha"
|
||||
RECAPTCHA = "recaptcha"
|
||||
HCAPTCHA = "hcaptcha"
|
||||
MTCAPTCHA = "mtcaptcha"
|
||||
FUNCAPTCHA = "funcaptcha"
|
||||
CLOUDFLARE = "cloudflare"
|
||||
OTHER = "other"
|
||||
|
||||
|
||||
class ActionStatus(StrEnum):
|
||||
pending = "pending"
|
||||
skipped = "skipped"
|
||||
@@ -82,9 +92,10 @@ class InputOrSelectContext(BaseModel):
|
||||
is_location_input: bool | None = None # address input usually requires auto completion
|
||||
is_date_related: bool | None = None # date picker mini agent requires some special logic
|
||||
date_format: str | None = None
|
||||
is_text_captcha: bool | None = None
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f"InputOrSelectContext(field={self.field}, is_required={self.is_required}, is_search_bar={self.is_search_bar}, is_location_input={self.is_location_input}, intention={self.intention})"
|
||||
return f"InputOrSelectContext(field={self.field}, is_required={self.is_required}, is_search_bar={self.is_search_bar}, is_location_input={self.is_location_input}, is_date_related={self.is_date_related}, date_format={self.date_format}, is_text_captcha={self.is_text_captcha}, intention={self.intention})"
|
||||
|
||||
|
||||
class ClickContext(BaseModel):
|
||||
@@ -266,6 +277,7 @@ class NullAction(Action):
|
||||
|
||||
class SolveCaptchaAction(Action):
|
||||
action_type: ActionType = ActionType.SOLVE_CAPTCHA
|
||||
captcha_type: CaptchaType | None = None
|
||||
|
||||
|
||||
class SelectOptionAction(WebAction):
|
||||
|
||||
Reference in New Issue
Block a user