diff --git a/internal/scraper/scraper.go b/internal/scraper/scraper.go index 91b1399..f7c5c2c 100644 --- a/internal/scraper/scraper.go +++ b/internal/scraper/scraper.go @@ -339,6 +339,16 @@ func ClosePlaywright() { } } +// InitBrowser initializes the browser +func InitBrowser() error { + return InitPlaywright() +} + +// CloseBrowser closes the browser +func CloseBrowser() { + ClosePlaywright() +} + // FetchWebpageContent retrieves the content of a webpage using Playwright func FetchWebpageContent(urlStr string) (string, error) { logger.Printf("Fetching webpage content for URL: %s\n", urlStr) diff --git a/internal/scraper/scraper_test.go b/internal/scraper/scraper_test.go index b7417c1..4d7b0a5 100644 --- a/internal/scraper/scraper_test.go +++ b/internal/scraper/scraper_test.go @@ -144,11 +144,11 @@ This is a **test** paragraph. } func TestExtractLinks(t *testing.T) { - // Initialize the browser before running the test - if err := InitBrowser(); err != nil { - t.Fatalf("Failed to initialize browser: %v", err) + // Initialize Playwright before running the test + if err := InitPlaywright(); err != nil { + t.Fatalf("Failed to initialize Playwright: %v", err) } - defer CloseBrowser() + defer ClosePlaywright() server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "text/html")