feature: действие inner_text; запросы v2 в test_main.http

This commit is contained in:
protokey committed 2026-10-13 20:21:17 +04:00
1 parent 6ce8a8c648
commit 49a2f3024a
3 files changed
+27 -8

No files matched your search

+8
View File
@@ -1,4 +1,5 @@
import asyncio
import re
import time
from patchright.async_api import Page
@@ -71,6 +72,13 @@ async def inner_html(page: Page, act: ActionRequest, **kwargs) -> str | None:
return await element.inner_html()
@register
async def inner_text(page: Page, act: ActionRequest, **kwargs) -> str | None:
html_source = await inner_html(page, act, **kwargs)
text = re.sub(r"<[^>]+>", "", html_source)
return text
@register
async def wait_for(page: Page, act: ActionRequest, **kwargs) -> str | None:
await page.wait_for_selector(act.selector, timeout=act.timeout * 1000)
+1
View File
@@ -17,6 +17,7 @@ _REQUIRED_FIELDS: dict[str, tuple[str, ...]] = {
"click": ("selector",),
"submit": ("selector",),
"inner_html": ("selector",),
"inner_text": ("selector",),
"wait_for": ("selector",),
"pass_challenge": (),
}