Honor configured browser engine
This commit is contained in:
@@ -69,6 +69,7 @@ This project replaces the Excel/VBA workflow named `Catalog maker - 20` with a N
|
|||||||
- Use Playwright for all supplier/manufacturer website scraping and browser page inspection.
|
- Use Playwright for all supplier/manufacturer website scraping and browser page inspection.
|
||||||
- Do not implement new scraping with raw `fetch`, regex-only HTML parsing, Selenium or direct HTTP shortcuts.
|
- Do not implement new scraping with raw `fetch`, regex-only HTML parsing, Selenium or direct HTTP shortcuts.
|
||||||
- Scrapers must use controlled browser navigation, selectors, explicit waits and bounded request counts.
|
- Scrapers must use controlled browser navigation, selectors, explicit waits and bounded request counts.
|
||||||
|
- The configured browser engine for a source is authoritative. If a source says `firefox`, launch Firefox or fail loudly; do not silently fall back to Chromium, Edge or another browser.
|
||||||
- Keep scraping slow and observable, preserve source URL/status information, and handle blocked pages or missing selectors as explicit errors.
|
- Keep scraping slow and observable, preserve source URL/status information, and handle blocked pages or missing selectors as explicit errors.
|
||||||
- Supplier data remains a local draft until the user explicitly confirms an Apply / Save action.
|
- Supplier data remains a local draft until the user explicitly confirms an Apply / Save action.
|
||||||
|
|
||||||
|
|||||||
@@ -58,13 +58,7 @@ function launchBrowser(engine, headless) {
|
|||||||
...(executablePath ? { executablePath } : {}),
|
...(executablePath ? { executablePath } : {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
return browserType.launch(options).catch((error) => {
|
return browserType.launch(options);
|
||||||
if (normalizedEngine !== "firefox") throw error;
|
|
||||||
|
|
||||||
const chromiumPath = resolveSystemBrowser("chromium");
|
|
||||||
if (!chromiumPath) throw error;
|
|
||||||
return chromium.launch({ headless, timeout: 10_000, executablePath: chromiumPath });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveSystemBrowser(engine) {
|
function resolveSystemBrowser(engine) {
|
||||||
|
|||||||
Reference in New Issue
Block a user