MCPcopy
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / test_scrape_selenium_exception

Function test_scrape_selenium_exception

tests/test_chromium.py:1247–1260  ·  view source on GitHub ↗

Test that the scrape method for selenium backend raises a ValueError when ascrape_undetected_chromedriver fails.

(monkeypatch)

Source from the content-addressed store, hash-verified

1245
1246@pytest.mark.asyncio
1247async def test_scrape_selenium_exception(monkeypatch):
1248 """Test that the scrape method for selenium backend raises a ValueError when ascrape_undetected_chromedriver fails."""
1249
1250 async def failing_scraper(url):
1251 raise Exception("dummy error")
1252
1253 urls = ["http://example.com"]
1254 loader = ChromiumLoader(urls, backend="selenium", retry_limit=1, timeout=5)
1255 loader.browser_name = "chromium"
1256 monkeypatch.setattr(loader, "ascrape_undetected_chromedriver", failing_scraper)
1257 with pytest.raises(
1258 ValueError, match="Failed to scrape with undetected chromedriver: dummy error"
1259 ):
1260 await loader.scrape("http://example.com")
1261
1262
1263@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 2

scrapeMethod · 0.95
ChromiumLoaderClass · 0.90

Tested by

no test coverage detected