Spaces:
Running
Running
fix clear text
Browse files
src/proxy_lite/browser/browser.py
CHANGED
@@ -5,6 +5,7 @@ from contextlib import AsyncExitStack
|
|
5 |
from pathlib import Path
|
6 |
from typing import Literal, Optional, Self
|
7 |
|
|
|
8 |
from playwright.async_api import Browser, BrowserContext, Page, Playwright, async_playwright
|
9 |
from playwright.async_api import TimeoutError as PlaywrightTimeoutError
|
10 |
from playwright_stealth import stealth_async
|
@@ -371,8 +372,13 @@ class BrowserSession:
|
|
371 |
if existing_text.strip():
|
372 |
# Clear existing text only if it exists
|
373 |
await self.click(mark_id)
|
374 |
-
|
375 |
-
|
|
|
|
|
|
|
|
|
|
|
376 |
await self.current_page.keyboard.press("Backspace")
|
377 |
|
378 |
|
|
|
5 |
from pathlib import Path
|
6 |
from typing import Literal, Optional, Self
|
7 |
|
8 |
+
import platform
|
9 |
from playwright.async_api import Browser, BrowserContext, Page, Playwright, async_playwright
|
10 |
from playwright.async_api import TimeoutError as PlaywrightTimeoutError
|
11 |
from playwright_stealth import stealth_async
|
|
|
372 |
if existing_text.strip():
|
373 |
# Clear existing text only if it exists
|
374 |
await self.click(mark_id)
|
375 |
+
if platform.system() == "Darwin": # selecting all text is OS-specific
|
376 |
+
await self.click(mark_id)
|
377 |
+
await self.current_page.keyboard.press("Meta+a")
|
378 |
+
await self.current_page.keyboard.press("Backspace")
|
379 |
+
else:
|
380 |
+
await self.current_page.keyboard.press("Control+Home")
|
381 |
+
await self.current_page.keyboard.press("Control+Shift+End")
|
382 |
await self.current_page.keyboard.press("Backspace")
|
383 |
|
384 |
|