mirror of
https://github.com/actionbook/actionbook.git
synced 2026-09-19 03:28:06 +08:00
5662e46c3a
Add #[allow(dead_code)] attributes to: - Camoufox WebDriver driver unused fields and methods - Camoufox REST API client unused imports - Browser router helper methods (as_cdp, as_camofox, etc.) - Fingerprint generator module (Phase 2 - not yet integrated) - Human behavior simulation module (Phase 3 - not yet integrated) - Enhanced stealth module (Phase 1 - not yet integrated) These are preparatory implementations for future Camoufox backend integration. Suppressing warnings keeps build output clean while preserving the code for upcoming CLI integration. Modified files: - src/browser/camofox/mod.rs - src/browser/camofox_webdriver/driver.rs - src/browser/fingerprint_generator.rs - src/browser/human_behavior.rs - src/browser/mod.rs - src/browser/router.rs - src/browser/stealth_enhanced.rs
48 lines
1.4 KiB
Python
48 lines
1.4 KiB
Python
"""Quick test script to verify server startup."""
|
|
|
|
import asyncio
|
|
from browser import CamofoxBrowserManager
|
|
|
|
|
|
async def test_browser():
|
|
"""Test browser initialization and basic operations."""
|
|
print("🧪 Testing Camoufox Browser Manager...")
|
|
|
|
manager = CamofoxBrowserManager()
|
|
|
|
try:
|
|
# Test tab creation
|
|
print("\n1. Creating tab...")
|
|
tab = await manager.create_tab("test-user", "test-session", "https://example.com")
|
|
print(f"✅ Tab created: {tab.id}")
|
|
print(f" URL: {tab.url}")
|
|
|
|
# Test accessibility tree
|
|
print("\n2. Getting accessibility tree...")
|
|
tree = await manager.get_accessibility_tree(tab.id, "test-user")
|
|
print(f"✅ Accessibility tree retrieved")
|
|
print(f" Root role: {tree['role']}")
|
|
print(f" Root name: {tree.get('name')}")
|
|
|
|
# Test screenshot
|
|
print("\n3. Taking screenshot...")
|
|
screenshot_b64 = await manager.screenshot(tab.id, "test-user")
|
|
print(f"✅ Screenshot taken: {len(screenshot_b64)} chars (base64)")
|
|
|
|
print("\n✅ All tests passed!")
|
|
|
|
except Exception as e:
|
|
print(f"\n❌ Test failed: {e}")
|
|
import traceback
|
|
traceback.print_exc()
|
|
|
|
finally:
|
|
# Cleanup
|
|
print("\n4. Cleaning up...")
|
|
await manager.cleanup()
|
|
print("✅ Cleanup complete")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test_browser())
|