js_render=true
to function, as they operate within the browser environment during page rendering.wait_for
to handle dynamic content loading
wait_for
, this instruction is useful when you need to accommodate processes that don’t have visible indicators or when you need to ensure stability after rapid interactions.
wait
instruction is 10 seconds, and the total combined duration of all wait
instructions cannot exceed 30 seconds. For example, you could use three {"wait": 10000}
instructions (10 seconds each) but not four. This 30-second limit contributes to the overall 40-second timeout for the entire JavaScript Instructions sequence.networkidle
- No network requests for 500ms (ideal for SPAs with API calls)networkalmostidle
- No more than 2 network requests for 500ms (less strict timing)load
- Page load event fired (all resources including images loaded)domcontentloaded
- DOM parsing completed (faster than load event)check
on an already checked element will not uncheck it. Use uncheck
specifically to deselect elements. This prevents accidental state changes in your automation.evaluate
)wait
instructions before and after the CAPTCHA-solving step, allowing time for the CAPTCHA to load and be resolved.json_response=true
to your request:
Issue | Cause | Solution |
---|---|---|
Element not found | Selector doesn’t match any elements | Verify selector in browser DevTools |
Click not working | Element not clickable or covered | Use wait_for to ensure element is ready |
Form submission fails | Missing required fields | Fill all required fields before submitting |
Timeout errors | Content takes too long to load | Increase wait times or use wait_for |
Instructions skip | Previous instruction failed | Check debug report for failed instructions |
Iframe content missing | Using standard instructions on iframe | Use frame_* instructions for iframe elements |
Verify selector in browser
Check element timing
Use alternative selectors
Check for dynamic content
js_instructions
parameter doesn’t increase the request cost. You pay the JavaScript Render (5 times the standard price) regardless of the wait value you choose.
What happens if an instruction fails?
json_response=true
to get detailed failure information and adjust your instructions accordingly. Critical failures may require adding wait_for
instructions to ensure elements are available.Can I use JavaScript Instructions without js_render?
js_render=true
because they operate within a browser environment. Static HTML requests cannot execute dynamic interactions or JavaScript code.How long do JavaScript Instructions take to execute?
Can I interact with elements inside iframes?
frame_click
, frame_fill
, and frame_wait_for
to interact with elements inside iframes. You’ll need to specify the iframe selector as the first parameter.What's the maximum number of instructions I can use?
How do I handle CAPTCHAs in my instructions?
solve_captcha
instruction with a configured 2Captcha API key. Add wait instructions before and after CAPTCHA solving to allow time for loading and verification. Different CAPTCHA types require specific configuration options.Can I modify the page content with JavaScript Instructions?
evaluate
instruction to run custom JavaScript code that can modify page content, styling, or behavior. This is useful for removing overlays, triggering custom events, or preparing the page for data extraction.