Market is a Windows desktop tool (WPF) for scraping product pricing information from multiple online retailers and storing results in a local SQLite database. It uses Selenium WebDriver (ChromeDriver) to automate browser interaction and CSS/XPath selectors configured via WebControl.xml.
⚠️ This project is a prototype / research tool. It contains early-stage scraping logic (hard-coded selectors, no robust error handling) and is intended for exploration or further refactoring rather than production use.
MarketAnalyzer/— WPF UI project (entry point) that drives scraping tasks and lets you select vendors and options.MarketCore/— Core scraping logic (vendor-specific scrapers + controller + config reader).Marketdb/— Local SQLite database management and tables storage.Logger/— Simple file logger used across projects.packages/— NuGet packages and third-party binaries (EntityFramework, SQLite, Selenium, etc.)
- Windows (project targets .NET Framework 4.0 / Visual Studio 2010 era)
- Visual Studio (2012/2013/2015 should open the solution, but older VS may be required for compatibility)
- Chrome (a version compatible with the bundled ChromeDriver)
- ChromeDriver on
PATHor placed next to the executable (the code callsnew ChromeDriver()with no path)
- Open
MarketAnalyzer.slnin Visual Studio. - Restore NuGet packages, or ensure
packages/directory exists and contains required assemblies. - Build the solution.
- Run the
MarketAnalyzerproject (WPF UI). - Choose a vendor by checking a checkbox, or provide a direct URL in the input box.
Multi Taskingenables per-vendor scraping in a separate thread.
-
Selectors and vendor configuration:
MarketCore/WebControl.xml- Contains vendor-specific CSS/XPath selectors for search boxes, results, prices, etc.
- When a site changes its HTML structure, update the selector entries to match.
-
Database file:
MarketDataBaseFile.sqlite- Created/overwritten automatically when
MarketDatabaseOperations()is constructed without parameters. - Contains two tables:
MasterProductTableandPriceTable.
- Created/overwritten automatically when
-
Log file:
MarketLog.log- Written by
MarketLogger.Logger.
- Written by
- The UI (
MarketAnalyzer/MainWindow.xaml.cs) createsPageControllerinstances for each selected vendor. PageControllerreads master products from the SQLite database and calls vendor-specific scraper classes (e.g.,Amazon,BestBuy, etc.).- Each vendor scraper uses Selenium to navigate the vendor site, uses selectors from
WebControl.xml, and writes scraped prices to the database.
- Scraper logic is brittle (relies on hard-coded CSS selectors and XPath). Websites often change structure.
- Concurrency is implemented with raw
Threadobjects and no synchronization. - Database operations use string concatenation for SQL (risk of SQL injection and errors if data contains quotes).
- The SQLite file is deleted & recreated by default on startup (
MarketDatabaseOperations.CreateDatabase()), so data is not persisted across runs unless you use the alternate constructor (new MarketDatabaseOperations("No Operations")).
- Add a proper configuration layer + a shipping of a structured mapping file (JSON/YAML) for selectors.
- Use a proper ORM or parameterized queries (avoid string concatenation in SQL).
- Replace
ThreadwithTask/asyncand improve UI responsiveness. - Add unit tests and vendor extraction contract interfaces.
If you want a more detailed architecture/design overview, see docs/Architecture.md and docs/Design.md.