MCPcopy
hub / github.com/unclecode/crawl4ai / test_custom_user_agent

Function test_custom_user_agent

tests/async/test_parameters_and_options.py:57–64  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

55
56@pytest.mark.asyncio
57async def test_custom_user_agent():
58 async with AsyncWebCrawler(verbose=True) as crawler:
59 url = "https://www.nbcnews.com/business"
60 custom_user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Crawl4AI/1.0"
61 result = await crawler.arun(url=url, user_agent=custom_user_agent, bypass_cache=True)
62
63 assert result.success
64 # Note: We can't directly verify the user agent in the result, but we can check if the crawl was successful
65
66@pytest.mark.asyncio
67async def test_extract_media_and_links():

Callers

nothing calls this directly

Calls 2

AsyncWebCrawlerClass · 0.90
arunMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…