The JavaScript Problem
In 2026, over 80% of websites use JavaScript to render content. This presents a significant challenge for web scrapers.
What Happens When You Scrape a JS Site
When you make a traditional HTTP request to a JavaScript-rendered website:
import requests
response = requests.get('https://react-website.com')
print(response.text)You get this:
<!DOCTYPE html>
<html>
<head><title>Loading...</title></head>
<body>
<div id="root"></div> <!-- Empty! -->
<script src="/bundle.js"></script>
</body>
</html>Instead of this:
<div id="root">
<div class="product-list">
<div class="product">iPhone 15 - $999</div>
<div class="product">Samsung S24 - $899</div>
<!-- Actual content -->
</div>
</div>The content is generated by JavaScript after the page loads in a browser. Traditional HTTP requests don't execute JavaScript.
Identifying JS-Rendered Sites
Quick Detection Methods
Method 1: View Page Source
- Right-click → "View Page Source"
- If you see empty
<div id="root">or<div id="app">→ JavaScript-rendered
Method 2: Disable JavaScript
- Open DevTools → Settings → Disable JavaScript
- Reload the page
- If content disappears → JavaScript-rendered
Method 3: Check for Framework Indicators
// React
document.querySelector('[data-reactroot]')
// Vue
document.querySelector('[data-v-]')
// Angular
document.querySelector('[ng-version]')Common JS-Rendered Platforms
| Platform Type | Examples | Framework |
|---|---|---|
| E-commerce | Shopify, BigCommerce | React/Vue |
| Social Media | Twitter, Instagram | React |
| SaaS Dashboards | Most B2B apps | React/Angular |
| News Sites | Many modern publishers | Various |
Solution Approaches
Approach Comparison
| Method | Speed | Reliability | Complexity | Cost |
|---|---|---|---|---|
| LucidExtractor API | Fast | High | Very Low | Per-credit |
| Headless Browser (Self-hosted) | Slow | Medium | High | Infrastructure |
| API Interception | Very Fast | Variable | Medium | Low |
| Server-Side Rendering Detection | Fast | Low | Medium | Low |
Decision Framework
Is it a JS-rendered site?
├── Yes
│ ├── Can you find the underlying API?
│ │ ├── Yes → Use API Interception (fastest)
│ │ └── No → Use JS Rendering
│ │ ├── Production/Scale → LucidExtractor API
│ │ └── Learning/Simple → Self-hosted Playwright
└── No → Traditional HTTP scrapingUsing Headless Browsers
What is a Headless Browser?
A headless browser is a web browser without a graphical user interface. It executes JavaScript just like Chrome or Firefox, but runs programmatically.
Popular Options
- Playwright (Microsoft) - Best for modern web apps
- Puppeteer (Google) - Chrome-focused
- Selenium - Legacy, widely supported
Playwright Example
from playwright.sync_api import sync_playwright
def scrape_react_site(url):
with sync_playwright() as p:
# Launch browser
browser = p.chromium.launch(headless=True)
page = browser.new_page()
# Navigate and wait for content
page.goto(url)
page.wait_for_selector('.product-list')
# Extract data
products = page.query_selector_all('.product-card')
data = []
for product in products:
data.append({
'name': product.query_selector('.name').inner_text(),
'price': product.query_selector('.price').inner_text(),
})
browser.close()
return data
# Usage
products = scrape_react_site('https://react-store.com')Problems with Self-Hosted Browsers
- Infrastructure Overhead - Need servers with Chrome installed
- Memory Usage - Each browser instance uses 200-500MB RAM
- Detection - Headless browsers are easily detected
- Maintenance - Browser updates, crashes, timeouts
API Interception Method
The Smart Approach
Many JavaScript sites fetch data from REST APIs. If you can find these APIs, you can skip rendering entirely.
Finding Hidden APIs
Step 1: Open DevTools Network Tab
1. Open Chrome DevTools (F12)
2. Go to Network tab
3. Filter by "Fetch/XHR"
4. Reload the page
5. Look for API callsStep 2: Analyze API Requests
Common patterns:
- /api/v1/products
- /graphql
- /_next/data/...
- /wp-json/...Step 3: Replicate the Request
import requests
# Direct API call (much faster than rendering!)
response = requests.get(
'https://store.com/api/products',
headers={
'Accept': 'application/json',
'X-Requested-With': 'XMLHttpRequest'
}
)
products = response.json()When This Doesn't Work
- API requires authentication
- API uses encryption/obfuscation
- GraphQL with complex queries
- Rate limited aggressively
Wait Strategies
When using headless browsers, knowing when content is ready is crucial.
Wait Strategy Comparison
| Strategy | Use Case | Reliability |
|---|---|---|
| Fixed timeout | Simple pages | Low |
| Selector wait | Known elements | High |
| Network idle | Complete loading | High |
| Custom function | Complex conditions | Highest |
Implementation Examples
Wait for Selector:
# Wait for specific element to appear
page.wait_for_selector('.product-list', timeout=30000)Wait for Network Idle:
# Wait until no network requests for 500ms
page.wait_for_load_state('networkidle')Wait for Custom Condition:
# Wait until 10 products are loaded
page.wait_for_function(
'document.querySelectorAll(".product").length >= 10'
)Wait for Specific Text:
# Wait until "Loading" disappears
page.wait_for_function(
'!document.body.innerText.includes("Loading...")'
)The LucidExtractor Solution
LucidExtractor handles all JavaScript rendering complexity automatically.
Simple API Call
import requests
response = requests.post(
'https://api.lucidextractor.com/v1/scrape',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'url': 'https://react-website.com/products',
'render_js': True, # Enable JS rendering
'wait_for': '.product-list', # Wait for content
'timeout': 30000
}
)
data = response.json()
print(data['content']) # Fully rendered HTMLAdvanced Options
response = requests.post(
'https://api.lucidextractor.com/v1/scrape',
json={
'url': 'https://complex-spa.com',
'render_js': True,
# Wait strategies
'wait_for': '.data-loaded',
'wait_for_timeout': 5000, # Additional wait
# Handle infinite scroll
'scroll_to_bottom': True,
'scroll_delay': 1000,
# Execute custom JavaScript
'execute_js': 'document.querySelector(".load-more").click()',
# Extract structured data
'extract': {
'products': {
'selector': '.product',
'type': 'list',
'fields': {
'name': '.title',
'price': '.price',
'rating': '.stars@data-rating'
}
}
}
}
)Why LucidExtractor for JS Sites?
| Challenge | LucidExtractor Solution |
|---|---|
| Browser infrastructure | Managed cloud browsers |
| Detection/blocking | Stealth mode + residential proxies |
| Memory/scaling | Serverless, scales instantly |
| Wait timing | Smart auto-detection |
| Maintenance | Zero maintenance required |
Real-World Examples
Example 1: Scraping a React E-commerce Site
import requests
def scrape_shopify_store(store_url):
response = requests.post(
'https://api.lucidextractor.com/v1/scrape',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'url': f'{store_url}/collections/all',
'render_js': True,
'wait_for': '.product-grid',
'extract': {
'products': {
'selector': '.product-card',
'type': 'list',
'fields': {
'name': '.product-title',
'price': '.product-price',
'image': 'img@src',
'link': 'a@href'
}
}
}
}
)
return response.json()['data']['products']
# Usage
products = scrape_shopify_store('https://example-store.myshopify.com')
print(f"Found {len(products)} products")Example 2: Vue.js Dashboard Data
def scrape_vue_dashboard(dashboard_url, auth_token):
response = requests.post(
'https://api.lucidextractor.com/v1/scrape',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'url': dashboard_url,
'render_js': True,
'headers': {
'Authorization': f'Bearer {auth_token}'
},
'wait_for': '[data-v-]', # Vue component indicator
'wait_for_timeout': 3000,
'extract': {
'metrics': {
'selector': '.metric-card',
'type': 'list',
'fields': {
'label': '.metric-label',
'value': '.metric-value'
}
}
}
}
)
return response.json()['data']['metrics']Example 3: Infinite Scroll Page
def scrape_infinite_scroll(url, max_items=100):
response = requests.post(
'https://api.lucidextractor.com/v1/scrape',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json={
'url': url,
'render_js': True,
'scroll_to_bottom': True,
'scroll_count': 10, # Scroll 10 times
'scroll_delay': 2000, # Wait 2s between scrolls
'wait_for_function': f'document.querySelectorAll(".item").length >= {max_items}',
'extract': {
'items': {
'selector': '.item',
'type': 'list'
}
}
}
)
return response.json()['data']['items'][:max_items]Conclusion
JavaScript-rendered websites are no longer a barrier to data extraction. Whether you choose:
- API Interception for direct data access
- Headless Browsers for learning and simple projects
- LucidExtractor for production-ready scraping
The key is choosing the right tool for your needs.
LucidExtractor eliminates the complexity of JavaScript rendering:
- ✅ No browser infrastructure to manage
- ✅ Automatic wait strategies
- ✅ Stealth mode to avoid detection
- ✅ Scales from 1 to millions of pages
Ready to scrape any JavaScript website? Start with 500 free credits →
Try it on a page you care about
500 free credits every month. No card needed, and every feature is included.


