Historically, Python used Selenium’s WebDriver interface to control the separate PhantomJS executable; PhantomJS itself ran JavaScript, not Python. That integration is now legacy: the PhantomJS project says development is suspended, its GitHub repository has been read-only since May 30, 2023, and its 2.1 release dates to January 23, 2016. For new Python automation, use Selenium with a maintained browser such as Chrome.
How the historical Python–PhantomJS integration worked
PhantomJS was a headless browser based on QtWebKit, with a JavaScript API for tasks such as page automation, screenshots, testing, and network monitoring. Python did not call that page API directly. Instead, Python code sent browser commands through Selenium WebDriver to the PhantomJS executable, using GhostDriver, which was embedded in PhantomJS.
The PhantomJS command-line reference applies to version 2.1.1. It documents starting the WebDriver endpoint with --webdriver; the default address is 127.0.0.1:8910. Separately, PhantomJS scripts are JavaScript files run from the command line as phantomjs [options] somescript.js. The project’s API documentation shows JavaScript calls such as page.open(url, callback), whose callback receives a status of success or fail. See the PhantomJS project homepage, command-line reference, and page.open API reference.
The project states, “Important: PhantomJS development is suspended until further notice.” PhantomJS 2.1 was released on January 23, 2016, and the GitHub repository was archived on May 30, 2023. Those dates matter when deciding whether to retain a legacy integration or build a new one.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11#1 Best Overall
Running an existing PhantomJS script
If you are maintaining an old script, run its JavaScript file with the PhantomJS executable. This is not Python code:
phantomjs somescript.js
Options may be placed between the executable and the script name. For example, the documented WebDriver mode is started with --webdriver; consult the 2.1.1 command-line reference for its options. The Python side of an old integration would connect through Selenium to that WebDriver service. Do not assume a legacy call such as webdriver.PhantomJS() works with a current Selenium release: the available project documentation does not establish compatibility between contemporary Selenium versions and PhantomJS.
Rank #2
Use Selenium with headless Chrome for new Python code
Selenium’s current Python documentation supports browser automation with maintained browser options including Chrome, Edge, Firefox, Safari, WebKitGTK, and WPEWebKit. Choose the browser engine that matches the users or environment your automation needs to represent. For a local Chrome example, Selenium documents creating a Chrome WebDriver and Chrome documents the --headless=new argument:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
options = Options()
options.add_argument("--headless=new")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
print(driver.title)
finally:
driver.quit()
Install Selenium in the Python environment used to run the script, and install Chrome. Selenium Manager generally handles driver setup when webdriver.Chrome() is created. If you install and manage ChromeDriver yourself, the official Chrome guidance says its major version must match the browser’s major version. See Selenium documentation and ChromeDriver version selection.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Choose the execution model that fits the job
- Local browser automation: use Selenium with the browser your application must support, then run the script on a machine with that browser installed.
- Remote or grid execution: Selenium also supports running sessions through a remote Grid; this is an optional deployment model, not a requirement for a local script.
- HTTP retrieval rather than browser behavior: if the task only needs a straightforward HTTP response and parsing, a browser-automation stack may be unnecessary. Use browser automation when JavaScript execution, browser rendering, or UI interaction is part of the requirement.
Or skip the browser setup
If your goal is a website screenshot rather than interactive browser testing, ScreenshotNeo can return an image or PDF from one GET request. Its API can accept and remove cookie-consent banners, newsletter popups, and chat widgets before capture; those steps can be turned off. Bot checks, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers identify the page verdict and billing status. ScreenshotNeo also provides an MCP server with screenshot, page-info, and PDF tools for AI agents.
For example, this cURL request saves a screenshot of example.com as WebP. Replace YOUR_API_KEY with your API key. See the API documentation for output and capture options.
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://example.com -o shot.webp
The free plan includes 1,000 screenshots per month with no card required; paid plans start at $5 for 3,000 screenshots. Sign up for free and get 1,000 screenshots a month with no card.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Troubleshooting
PhantomJS is not found
The command-line executable is missing or is not on the shell’s PATH. Install or locate the legacy executable for the environment where the script runs, then verify the shell can invoke phantomjs. Because the project is suspended, do not treat this as a maintained setup for new deployments.
Quick wins for a faster PC:
Repair Windows errors before they cause bigger problemsFix Now →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →The Python PhantomJS WebDriver call fails
A legacy Selenium binding may not be compatible with the Selenium version installed. The cited PhantomJS documentation does not establish a working pairing with current Selenium, so do not try to fix this by assuming an old constructor remains supported. For new work, migrate the WebDriver session to a supported browser; if preserving the old system is unavoidable, verify the exact Selenium and PhantomJS versions in that environment.
Best Value
The WebDriver connection is refused
Check that the PhantomJS process started in WebDriver mode and that Python is connecting to the same host and port. The documented default endpoint is 127.0.0.1:8910; a custom --webdriver port requires the client to use that port too.
Chrome starts but the script cannot find its driver
Allow Selenium Manager to resolve the driver when creating webdriver.Chrome(), or check your manual driver installation. When managing it yourself, ensure ChromeDriver and Chrome have matching major versions as specified by Chrome’s version-selection guidance.
A page looks different in headless mode
Headless execution is still browser automation, but it may not match the assumptions of an old QtWebKit-based PhantomJS run. Confirm the chosen browser engine is appropriate for the target, and debug the page in that same browser before attributing a difference to Python or Selenium.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




