Environment:AI4Finance Foundation FinGPT Selenium
| Knowledge Sources | |
|---|---|
| Domains | Web_Scraping, Automation |
| Last Updated | 2026-10-18 00:00 GMT |
Overview
Selenium WebDriver browser automation for scraping JavaScript-rendered financial news pages and Twitter content.
Description
This environment provides Selenium 4 with ChromeDriver for headless browser automation. The RAG multisource retrieval news scraper uses Selenium to render and scrape dynamic news pages that require JavaScript execution. Chrome browser and ChromeDriver paths are configured via environment variables. The `webdriver-manager` package manages driver installation.
Usage
Use this environment for Multi-Source News Scraping when static HTML parsing (BeautifulSoup) is insufficient due to JavaScript rendering. Required by `scraping_by_url` for dynamic pages.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux / Mac / Windows | Requires Chrome browser |
| Hardware | CPU sufficient | No GPU needed |
| Software | Google Chrome | Chrome browser executable required |
Dependencies
System Packages
- Google Chrome browser
- ChromeDriver (or via `webdriver-manager`)
Python Packages
- `selenium` >= 4.13.0
- `webdriver-manager` >= 4.0.1
- `trio` >= 0.22.2
- `trio-websocket` >= 0.11.1
Credentials
The following environment variables may be set for Twitter scraping:
- `TWITTER_API_KEY`
- `TWITTER_API_KEY_SECRET`
- `TWITTER_ACCESS_TOKEN`
- `TWITTER_ACCESS_TOKEN_SECRET`
- `TWITTER_BEARER_TOKEN`
Quick Install
pip install selenium>=4.13.0 webdriver-manager>=4.0.1 trio>=0.22.2 trio-websocket>=0.11.1
Code Evidence
ChromeDriver path and browser path from `fingpt/FinGPT_RAG/multisource_retrieval/news_scraper.py:36-38`:
chrome_driver_path = '/usr/local/bin'
os.environ["PATH"] += os.pathsep + chrome_driver_path
chrome_browser_path = '/Applications/Google Chrome.app/Contents/MacOS/Google Chrome'
Selenium import from `fingpt/FinGPT_RAG/multisource_retrieval/news_scraper.py:16-18`:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `chromedriver not found` | ChromeDriver not in PATH | Install via `webdriver-manager` or set `chrome_driver_path` |
| `Chrome browser not found` | Chrome not installed | Install Google Chrome; update `chrome_browser_path` |
| `SessionNotCreatedException` | Chrome/Driver version mismatch | Use `webdriver-manager` to auto-download matching driver |
Compatibility Notes
- Mac paths: Code has macOS-specific Chrome path; adjust for Linux (`/usr/bin/google-chrome`) or Windows.
- Headless mode: Use `options.add_argument('--headless')` for server environments.
- Twitter: Tweepy integration is commented out; Twitter scraping may require API v2 bearer token.