Selenium Python Script Runner avatar

Selenium Python Script Runner

Pricing

from $4.00 / 1,000 managed runtime (30 seconds)s

Go to Apify Store
Selenium Python Script Runner

Selenium Python Script Runner

Run Selenium Python scripts in the cloud without building and deploying your own Actor.

Pricing

from $4.00 / 1,000 managed runtime (30 seconds)s

Rating

0.0

(0)

Developer

Victor Gabriel Vianna

Victor Gabriel Vianna

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

4 days ago

Last modified

Categories

Share

Run existing trusted Selenium Python scripts on Apify without creating, packaging, and deploying a separate Actor project.

Paste your Python script, optionally add normal PyPI dependencies, JSON input, secrets, or an Apify proxy, then run it from the Apify Console, API, or schedules.

Use this Actor when you already have Selenium code and want to move the execution to the cloud without rebuilding it around an Actor project.

Minimal tested example

from selenium import webdriver
driver = webdriver.Chrome()
driver.get("https://example.com")
print(driver.title)
driver.quit()

Chrome, ChromeDriver, Selenium, and an Xvfb display are already provided.

For ordinary Selenium scripts like the example above, you do not need to add:

  • main()
  • a ChromeDriver path
  • --headless
  • --no-sandbox

The runtime handles the required managed-container Chrome configuration at the infrastructure level rather than modifying your Selenium code.

Inputs

  • code (required): Python code executed as an ordinary script.
  • requirements (optional): normal PyPI requirements, one per line. Direct URLs, VCS packages, local paths, index directives, and -r files are intentionally unsupported.
  • scriptInput (optional): arbitrary JSON. It is written to the JSON file identified by RUNNER_INPUT_PATH.
  • environmentVariables (optional, secret): string key/value pairs deliberately passed to your script, such as USERNAME, PASSWORD, or API_KEY.
  • scriptTimeoutSecs (optional): maximum user-script runtime from 1 to 900 seconds. Dependency setup has a separate 180-second limit.
  • proxyConfiguration (optional): Apify proxy configuration. When resolved, the proxy URL is exposed as RUNNER_PROXY_URL. Configure Selenium explicitly to use it; the Actor does not monkeypatch webdriver.Chrome().

V1 uses a fixed 2 GB memory allocation, validated in Apify Cloud with ordinary Chrome and longer-running browser execution.

Each run gets a fresh working directory and an ephemeral Python environment. Selenium and the Apify Python SDK are already available. Additional requirements are installed only inside the per-run environment and cannot modify the supervisor process.

Runtime billing

When pay-per-event pricing is active, the Actor charges one managed-runtime block before managed work begins and another before each additional 30 seconds of managed work.

The same runtime clock covers:

  • Python environment setup
  • dependency installation
  • browser execution
  • user-script execution

In V1, Apify platform usage is billed separately.

The Actor does not add a pay-per-event charge for items your script writes to the default Dataset.

If the run's spending limit cannot cover the next runtime block, the Actor stops the active process group cleanly and writes OUTPUT with:

failureReason: "spending_limit_reached"

This distinguishes a budget limit from a Python error or timeout.

Results and artifacts

Every run writes an OUTPUT record to the default Key-Value Store.

It contains information such as:

  • execution status
  • exit code
  • duration
  • bounded stdout and stderr
  • truncation flags
  • charged runtime blocks
  • artifact metadata

Failed scripts and timeouts persist OUTPUT before the Actor run fails, so schedules and API integrations receive a real failure state rather than a silent success.

Generated files

Files written directly below the script working directory are copied to the default Key-Value Store.

Their original names and retrievable record keys are listed in OUTPUT.

Artifact record keys use the artifacts. prefix because Apify Key-Value Store record keys cannot contain filesystem paths.

Current limits are:

  • maximum 50 files
  • maximum 10 MiB per file
  • maximum 50 MiB total

Runner internals, temporary inputs, and browser cache directories are excluded.

Chrome downloads

Normal Chrome downloads from the per-run HOME/Downloads directory are collected automatically.

Unusual download flows or browser configurations may require handling inside your own script.

Dataset

The default Dataset belongs to your script.

You can use the Apify Python SDK normally, for example:

import asyncio
from apify import Actor
async def main():
async with Actor:
await Actor.push_data({"result": "ok"})
asyncio.run(main())

The runner does not add administrative rows to your Dataset.

Security and scope

Run code you trust.

This Actor executes the Python code you provide. It is not a security sandbox for untrusted third-party code.

Operational controls include:

  • a separate subprocess
  • process-group cleanup
  • execution timeouts
  • an ephemeral per-run filesystem
  • isolated dependency installation
  • Apify Limited Permissions

These controls are designed for reliable execution, not hostile-code isolation.

The child process receives only required system settings, selected Apify runtime values, runner helper paths, and the values you explicitly provide through environmentVariables.

It does not inherit the supervisor environment wholesale.

Do not print secrets from your own script. User-script stdout and stderr are intentionally available in logs and in the bounded result summary.

Compatibility

V1 supports:

  • Python
  • Selenium
  • Chrome / Chromium
  • normal PyPI dependencies
  • Apify API and schedules
  • Apify proxy configuration
  • generated files and Chrome downloads
  • Apify Dataset and Key-Value Store access

V1 is not:

  • Selenium Grid
  • a browser farm
  • a generic Docker or VM runner
  • a repository runner
  • a hostile-code sandbox
  • an anti-bot bypass service

The Actor is designed to make ordinary Selenium Python scripts easier to run on Apify, but it does not guarantee that every existing Selenium setup, system dependency, or Python package combination will run unchanged.