-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Open
Labels
⚙ DoneBug fix, enhancement, FR that's completed pending releaseBug fix, enhancement, FR that's completed pending release🐞 BugSomething isn't workingSomething isn't working
Milestone
Description
crawl4ai version
0.7.4
Expected Behavior
C4AI correctly imports playwright_stealth and applies the stealth scripts and headers to the context
Current Behavior
The crawler throws an ImportError: cannot import name 'Stealth' from 'playwright_stealth' (/Users/martin/test/.venv/lib/python3.12/site-packages/playwright_stealth/init.py). Did you mean: 'stealth'?
Is this reproducible?
Yes
Inputs Causing the Bug
- BrowserConfig(enable_stealth=True)
Steps to Reproduce
1. Be on 0.7.4
2. Try to crawl with BrowserConfig(enable_stealth=True)
Code snippets
import asyncio
from crawl4ai import (
AsyncWebCrawler,
BrowserConfig,
CrawlerRunConfig,
)
from crawl4ai.async_crawler_strategy import AsyncPlaywrightCrawlerStrategy
async def test_stealth_mode():
browser_config = BrowserConfig(enable_stealth=True, headless=True)
crawler_strategy = AsyncPlaywrightCrawlerStrategy(
browser_config=browser_config,
)
async with AsyncWebCrawler(
config=browser_config, crawler_strategy=crawler_strategy
) as crawler:
result = await crawler.arun(
url="abc", config=CrawlerRunConfig(screenshot=False)
)
asyncio.run(test_stealth_mode())
OS
macOS
Python version
3.12
Browser
Chrome
Browser version
N/A
Error logs & Screenshots (if applicable)
File "/Users/martin/test/.venv/lib/python3.12/site-packages/crawl4ai/async_webcrawler.py", line 177, in start
await self.crawler_strategy.__aenter__()
File "/Users/martin/test/.venv/lib/python3.12/site-packages/crawl4ai/async_crawler_strategy.py", line 119, in __aenter__
await self.start()
File "/Users/martin/test/.venv/lib/python3.12/site-packages/crawl4ai/async_crawler_strategy.py", line 129, in start
await self.browser_manager.start()
File "/Users/martin/test/.venv/lib/python3.12/site-packages/crawl4ai/browser_manager.py", line 655, in start
from playwright_stealth import Stealth
ImportError: cannot import name 'Stealth' from 'playwright_stealth' (/Users/martin/test/.venv/lib/python3.12/site-packages/playwright_stealth/__init__.py). Did you mean: 'stealth'?
Metadata
Metadata
Assignees
Labels
⚙ DoneBug fix, enhancement, FR that's completed pending releaseBug fix, enhancement, FR that's completed pending release🐞 BugSomething isn't workingSomething isn't working