Test that the scrape method for selenium backend raises a ValueError when ascrape_undetected_chromedriver fails.
(monkeypatch)
| 1245 | |
| 1246 | @pytest.mark.asyncio |
| 1247 | async 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 |
nothing calls this directly
no test coverage detected