chore: добавил команду подождать
This commit is contained in:
1 parent
6e76d08de3
commit
733536e83e
2 files changed
+47
No files matched your search
@@ -1,3 +1,5 @@
|
||||
import asyncio
|
||||
|
||||
from playwright.async_api import Page
|
||||
|
||||
from engine.schemas import ActionRequest
|
||||
@@ -17,6 +19,12 @@ async def fill(page: Page, act: ActionRequest) -> str | None:
|
||||
await page.fill(act.selector, act.value)
|
||||
|
||||
|
||||
@register
|
||||
async def delay(page: Page, act: ActionRequest) -> str | None:
|
||||
assert act.value
|
||||
await asyncio.sleep(int(act.value))
|
||||
|
||||
|
||||
@register
|
||||
async def mouse_move(page: Page, act: ActionRequest) -> str | None:
|
||||
assert act.selector
|
||||
|
||||
@@ -69,3 +69,42 @@ Cookie: session_id=2f2100be-6ce7-40d5-bae5-61424b2504c8; Path=/; SameSite=lax
|
||||
}
|
||||
|
||||
###
|
||||
POST http://127.0.0.1:8000/v1/solve
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
X-API-Key: <key>
|
||||
Cookie: session_id=2f2100be-6ce7-40d5-bae5-61424b2504c8; Path=/; SameSite=lax
|
||||
|
||||
|
||||
{
|
||||
"url": "http://127.0.0.1:8001/",
|
||||
"proxy": "-",
|
||||
"actions": [
|
||||
{"type": "mouse_move", "selector": ".logout"},
|
||||
{"type": "delay", "value": "3"},
|
||||
{"type": "click", "selector": ".logout"},
|
||||
{"type": "wait_for", "selector": "#username", "timeout": 10}
|
||||
]
|
||||
}
|
||||
|
||||
###
|
||||
POST http://127.0.0.1:8000/v1/solve
|
||||
Accept: application/json
|
||||
Content-Type: application/json
|
||||
X-API-Key: <key>
|
||||
Cookie: session_id=2f2100be-6ce7-40d5-bae5-61424b2504c8; Path=/; SameSite=lax
|
||||
|
||||
|
||||
{
|
||||
"url": "http://127.0.0.1:8001/",
|
||||
"proxy": "-",
|
||||
"actions": [
|
||||
{"type": "mouse_move", "selector": ".menu-trigger"},
|
||||
{"type": "delay", "value": "2"},
|
||||
{"type": "click", "selector": "div.menu-item:nth-child(3)"},
|
||||
{"type": "mouse_move", "selector": ".logout"},
|
||||
{"type": "delay", "value": "10"}
|
||||
]
|
||||
}
|
||||
|
||||
###
|
||||
Reference in new issue
Block a user