Execute Script
AI-generatedSummary
Submits a Python script to a SeleniumBase server, optionally waits for completion, and returns the result or artifacts.
Inputs
- pythonCode (required) — The Python script to execute using the SeleniumBase library. Files saved to the working directory in the script become downloadable artifacts.
- options.maintainSessionConsistency — When enabled, creates a persistent browser profile using the node name as the ID to maintain cookies and state across executions.
- options.params — Key/value pairs sent as a 'params' payload to the script; accessible in Python as the constant SB_PARAMS.
- options.inputBinaryProperty — The name of the binary property from the input item to upload as an attachment to the script.
- options.waitForCompletion — If true, polls the server until the job finishes; if false, returns immediately after submission.
- options.downloadArtifacts — When true, downloads all artifact files (e.g., screenshots) generated by the script as binary data in the output.
- options.cleanJobAfterExecution — When true, deletes the job and its artifacts from the server after retrieving results.
- options.pollingInterval — The interval in seconds to poll for job status when waitForCompletion is enabled (default: 5).
- options.timeout — The maximum time in seconds to wait for job completion (default: 600).
Output shape
One item per input item containing JSON with job status, logs, and optional binary artifacts.
If the job fails, the node raises a NodeOperationError with details. The returned JSON includes job_id, status, logs (stdout/stderr), and error messages. Artifacts are downloaded as binary data when enabled.
Examples
Example 1: Run a simple headless browser script and download the resulting screenshot.
pythonCode: simple headless script; downloadArtifacts: true; cleanJobAfterExecution: true
Example 2: Run a script that requires a file input and maintain browser state across runs.
pythonCode: script using SB_PARAMS; inputBinaryProperty: 'uploadedFile'; maintainSessionConsistency: true
Example 3: Submit a script without waiting for it to finish, to process items in parallel.
pythonCode: script; waitForCompletion: false