Skip to content

Commit 523882f

Browse files
committed
async api
1 parent b8b6b53 commit 523882f

File tree

4 files changed

+8
-9
lines changed

4 files changed

+8
-9
lines changed

sentience/_extension_loader.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,3 @@ def find_extension_path() -> Path:
3838
f"2. {dev_ext_path}\n"
3939
"Make sure the extension is built and 'sentience/extension' directory exists."
4040
)
41-

sentience/async_api.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,7 @@ async def goto(self, url: str) -> None:
253253
f"5. Diagnostic info: {diag}"
254254
)
255255

256-
async def _inject_storage_state(
257-
self, storage_state: str | Path | StorageState | dict
258-
) -> None:
256+
async def _inject_storage_state(self, storage_state: str | Path | StorageState | dict) -> None:
259257
"""Inject storage state (cookies + localStorage) into browser context (async)"""
260258
import json
261259

@@ -628,7 +626,9 @@ async def _snapshot_via_api(
628626

629627
# Wait for extension injection
630628
try:
631-
await browser.page.wait_for_function("typeof window.sentience !== 'undefined'", timeout=5000)
629+
await browser.page.wait_for_function(
630+
"typeof window.sentience !== 'undefined'", timeout=5000
631+
)
632632
except Exception as e:
633633
raise RuntimeError(
634634
"Sentience extension failed to inject. Cannot collect raw data for API processing."
@@ -929,7 +929,9 @@ async def type_text(
929929
)
930930

931931

932-
async def press(browser: AsyncSentienceBrowser, key: str, take_snapshot: bool = False) -> ActionResult:
932+
async def press(
933+
browser: AsyncSentienceBrowser, key: str, take_snapshot: bool = False
934+
) -> ActionResult:
933935
"""
934936
Press a keyboard key (async)
935937

tests/test_async_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,4 +268,3 @@ async def test_async_snapshot_with_goal():
268268
assert snap.status == "success"
269269
# Elements may have ML reranking metadata if API key is provided
270270
# (This test works with or without API key)
271-

tests/test_browser.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"""
44

55
import pytest
6+
from playwright.sync_api import sync_playwright
67

78
from sentience import SentienceBrowser
8-
from playwright.sync_api import sync_playwright
99

1010

1111
@pytest.mark.requires_extension
@@ -168,4 +168,3 @@ def test_from_page_with_api_key():
168168
finally:
169169
context.close()
170170
browser_instance.close()
171-

0 commit comments

Comments
 (0)