Add returnScreenshot parameter to screenshot the final web page (#1439)

This commit is contained in:
Esteban Thilliez
2025-10-08 11:59:39 +02:00
committed by GitHub
parent 05a72f2709
commit 136422c85c
3 changed files with 7 additions and 1 deletions

View File

@@ -10,6 +10,7 @@ class ChallengeResolutionResultT:
response: str = None
cookies: list = None
userAgent: str = None
screenshot: str | None = None
def __init__(self, _dict):
self.__dict__.update(_dict)
@@ -41,6 +42,7 @@ class V1RequestBase(object):
url: str = None
postData: str = None
returnOnlyCookies: bool = None
returnScreenshot: bool = None
download: bool = None # deprecated v2.0.0, not used
returnRawHtml: bool = None # deprecated v2.0.0, not used
waitInSeconds: int = None

View File

@@ -397,6 +397,9 @@ def _evil_logic(req: V1RequestBase, driver: WebDriver, method: str) -> Challenge
challenge_res.response = driver.page_source
if req.returnScreenshot:
challenge_res.screenshot = driver.get_screenshot_as_base64()
res.result = challenge_res
return res