Unable to simulate the pull-down action to load products.- Need help #2118
Replies: 4 comments 9 replies
|
Hey @nanridao2026, by pull down do you mean scrolling down the page? |
|
Hi @nanridao2026, I dug into this on the exact URL you're using and found what's going on. After editing your script a bit, I got the full catalog (198 products) captured. A few separate issues are compounding here: 1. Your scroll JS runs fire-and-forget (the main bug)Crawl4AI wraps (async () => {
// scroll loop with awaits
})();the inner IIFE is started but never awaited — the wrapper returns immediately, and the crawler captures the HTML right away without waiting for your scroll loop. That's why you see no scrolling before the page closes. Fix: write 2. Jumping straight to the bottom doesn't trigger the lazy-loadI verified this live on the Bershka page: a single (For reference: there's no inner scroll container on this page — the document itself scrolls — so scrolling the window is correct; it just has to be incremental.) 3.
|
|
This is the code for the latter part.“ async with AsyncWebCrawler(config=config, crawler_strategy=crawler_strategy) as crawler: ...
{"name": "images", "selector": ".zoom-modal__swiper-tab img", "type": "list", "fields": [ {"name": "image", "type": "attribute", "attribute": "src" }] }, {"name": "colors", "selector": ".color-selector li a", "type": "list", "fields": [ {"name": "color", "type": "attribute", "attribute": "aria-label" }] }, {"name": "sizes","selector": ".size-selector span.size-button__label","type": "text"} ]})) The following error message appears after the code runs: Code context: |
|
Hello @nanridao2026, Thanks for sharing the second part of the workflow! Good news: you were not blocked by anti-bot protection. The What the log actually showsLook at the two lines before the error — both detail pages were fetched successfully: The crash happens after fetching, inside extraction: That's a Python The schema bugYour {"name": "description", "selector": ".bsk-drawer__content", "type": "attribute",
"name": "innerHTML"} # ← second "name" silently overwrites the firstYou almost certainly meant For grabbing HTML content, the cleaner form is: {"name": "description", "selector": ".bsk-drawer__content", "type": "html"}Fix the schema and the "anti-bot" error disappears. Two smaller bugs worth fixing while you're in there1. Your URLs have a doubled # yours — produces https://www.bershka.com/es/es/...
links = ["https://www.bershka.com/es" + p['link'] for p in products][:10]
# correct
links = ["https://www.bershka.com" + p['link'] for p in products][:10]The site happens to redirect, but that's an unnecessary redirect (and an extra bot signal) on every request. 2. Your CSV only ever contains the last product. all_products = []
for result in results:
if result.success and result.extracted_content:
all_products.extend(json.loads(result.extracted_content))
pd.DataFrame(all_products).to_csv('bershka_products.csv', index=False, encoding='utf-8-sig')About anti-bot on
|

Uh oh!
There was an error while loading. Please reload this page.
When I used Crawl4AI version 0.9.1 to simulate a pull-down, I initially observed no pull-down behavior in the viewport. I immediately closed the webpage (https://www.bershka.com/es/women/clothes/t-shirts-n4365.html) and used
undetected_adapter = UndetectedAdapter().All reactions