Browser worker vs Code worker
| Browser worker | Code worker | |
|---|---|---|
| Execution model | Headless browser session | Direct HTTP requests (like curl or requests.get) |
| Runs JavaScript | Yes | No |
| Clicks, scrolls, form input | Yes | No |
| Best for | Dynamic pages, SPAs, login flows, infinite scroll, GraphQL capture | Static HTML, sitemap crawls, public JSON APIs |
| Speed | Slower (browser startup, full page load) | Faster (single HTTP round trip) |
| Cost per page load | Higher | Lower |
When should I use Browser worker?
Use Browser worker when any of the following is true:- The target data is rendered client-side by JavaScript and is not present in the raw HTML response
- You need to click, scroll, hover, or type to reach or reveal the data
- You need to solve a cookie banner or dismiss a popup before the content renders
- You need to capture network traffic with
tag_response,tag_script, orcapture_graphql - You need to log in, hold a session, or interact with a form
When should I use Code worker?
Use Code worker when all of the following are true:- The full target data is present in the raw HTML response or in a public JSON endpoint
- No JavaScript execution is required to render the data
- No click, scroll, or type interaction is required
- You are crawling sitemaps, RSS feeds, or API endpoints
Which functions are Browser worker only?
Bright Data Scraper Studio functions that depend on a live browser session throw an error when called from a Code worker. Choose Browser worker if your scraper needs any of these:| Category | Functions |
|---|---|
| Waiting on the DOM | wait, wait_any, wait_for_text, wait_hidden, wait_visible, wait_network_idle, wait_page_idle |
| Scrolling | scroll_to, scroll_to_all, load_more |
| Traffic tagging | tag_response, tag_all_responses, tag_script, tag_image, tag_video, tag_screenshot, tag_download, tag_window_field, tag_serp, capture_graphql |
| Keyboard and mouse input | click, right_click, hover, mouse_to, press_key, type |
| Browser configuration | browser_size, emulate_device, freeze_page |
| Anti-bot | solve_captcha, close_popup |
Frequently asked questions
Can I switch worker type after building the scraper?
Can I switch worker type after building the scraper?
Yes. Open the scraper in the Bright Data Scraper Studio IDE and change the worker type in the Settings panel. If you switch from Browser worker to Code worker, remove any calls to the browser-only functions listed above or the scraper will throw an error on the next run.
Is Code worker really faster than Browser worker?
Is Code worker really faster than Browser worker?
Yes. Code worker issues a single HTTP request with no browser boot and no page render, so the round trip completes in a fraction of the time a browser-worker run takes. The exact speedup depends on the target site, but Code worker jobs typically finish in seconds.
Does Browser worker support capturing background API calls?
Does Browser worker support capturing background API calls?
Yes. Use
tag_response or tag_all_responses to capture any XHR or fetch the page makes, and capture_graphql to capture and replay GraphQL queries. See Scraper Studio functions for the full reference.Related
Scraper Studio functions
Full reference for interaction and parser commands
Best practices
Recommended patterns for writing efficient scrapers