From 3caf48c9be3e289e8e918c185486969f011ee9a5 Mon Sep 17 00:00:00 2001 From: unclecode Date: Sun, 1 Sep 2024 16:34:51 +0800 Subject: [PATCH] refactor: Update LocalSeleniumCrawlerStrategy to execute JS code if provided --- crawl4ai/crawler_strategy.py | 1 + 1 file changed, 1 insertion(+) diff --git a/crawl4ai/crawler_strategy.py b/crawl4ai/crawler_strategy.py index 66a8f7dd..4d049069 100644 --- a/crawl4ai/crawler_strategy.py +++ b/crawl4ai/crawler_strategy.py @@ -244,6 +244,7 @@ class LocalSeleniumCrawlerStrategy(CrawlerStrategy): driver.quit() # Execute JS code if provided + self.js_code = kwargs.get("js_code", self.js_code) if self.js_code and type(self.js_code) == str: self.driver.execute_script(self.js_code) # Optionally, wait for some condition after executing the JS code