Wait for CSS selector
How to improve web scraper performance and wait for the full page load
#
Waiting for CSS selectorGenerally, our system waits until the entire page load from the networking perspective. It means that the result will be returned right after the networking is performed.
Still, in some cases, a web scraper may require waiting for a particular DOM element appearance. This DOM element may appear in the HTML before and after the entire page load. So, with waiting for CSS selector feature, it's possible to decrease the ScrapingAnt API response time or make a delay after the whole page load to wait for the DOM element.
wait_for_selector
parameter#
Once wait_for_selector
parameter is specified, the ScrapingAnt service will no longer wait until the entire page load but wait for the desired DOM element appearance instead.
For example, with waiting for the element:
Your request will have the following look:
#
GET requestnote
Don't forget to urlencode wait_for_selector
parameter while using GET request
#
POST request#
How to create a CSS selector?Check out CSS selectors cheat sheet and CSS Selector Tester to prepare your CSS selector.