diff --git a/pages/partial/how_to_guide.html b/pages/partial/how_to_guide.html index b8f85ed6..3ad53ce4 100644 --- a/pages/partial/how_to_guide.html +++ b/pages/partial/how_to_guide.html @@ -139,13 +139,14 @@ crawler.warmup()
js_code = """
+ js_code = ["""
const loadMoreButton = Array.from(document.querySelectorAll('button')).find(button => button.textContent.includes('Load More'));
loadMoreButton && loadMoreButton.click();
-"""
+"""]
crawler_strategy = LocalSeleniumCrawlerStrategy(js_code=js_code)
crawler = WebCrawler(crawler_strategy=crawler_strategy, always_by_pass_cache=True)
result = crawler.run(url="https://www.nbcnews.com/business")
+ Remember that you can pass multiple JavaScript code snippets in the list. They all will be executed in the order they are passed.