Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Short answer: Selenium opens HTTP and HTTPS addresses the same way: create a WebDriver, call driver.get(url), inspect the page, and finish with driver.quit(). PhantomJS should not be your new implementation. Selenium’s 3.8.1 Python changelog states, “PhantomJS is now deprecated, please use either Chrome or Firefox in headless mode.” Its repository is archived read-only, with the archive recorded on May 30, 2023. Use a supported browser such as Chrome or Firefox (or another browser listed in current Selenium documentation) and treat PhantomJS code as migration material.

What changed: PhantomJS is a legacy option

PhantomJS was a headless browser often paired with older Selenium examples. It ran without a visible window and was convenient on servers, but it is no longer a current Selenium target. The official Selenium 3.8.1 changelog says: “PhantomJS is now deprecated, please use either Chrome or Firefox in headless mode.” The PhantomJS project repository is archived read-only.

That means an old snippet can explain how a historical application worked, but it should not guide a new production design. Current Selenium Python documentation lists Python 3.10 or newer and support for Chrome, Edge, Firefox, Safari, WebKitGTK and WPEWebKit; check the live documentation for changes before pinning an environment.

How Selenium opens HTTP and HTTPS URLs

HTTP and HTTPS are URL schemes supplied to the browser. Selenium does not require a different navigation method for either one:

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • driver.get("http://example.com") requests an HTTP address.
  • driver.get("https://example.com") requests an HTTPS address.

The browser performs DNS lookup, connection setup, redirects, TLS negotiation and certificate validation. Selenium controls the browser; it does not replace the browser’s TLS implementation. A successful get() call therefore means navigation was attempted and the browser reached a document, not that an HTTPS certificate is valid or that the site is safe.

Set up a supported Python 3 environment

1. Create an isolated virtual environment

  1. Install Python 3.10 or newer, matching the current Selenium Python documentation.
  2. Create and activate an environment:

On macOS or Linux:

python3 -m venv .venv
source .venv/bin/activate

On Windows PowerShell:

py -3 -m venv .venv
.venvScriptsActivate.ps1

2. Install Selenium

python -m pip install --upgrade pip
python -m pip install --upgrade selenium

For reproducible builds, resolve and test a specific Selenium version in your own dependency lock file after checking the current release documentation. Do not assume a version shown in an old blog post is still supported.

Modern headless example with Chrome

This complete example works for either scheme. It uses Selenium Manager, which current Selenium documentation says generally discovers, downloads and caches the required browser driver when a WebDriver is created.

from selenium import webdriver
from selenium.webdriver.chrome.options import Options

url = "https://example.com"  # Replace with an http:// URL when required
options = Options()
options.add_argument("--headless=new")

 driver = webdriver.Chrome(options=options)
try:
    driver.get(url)
    print("Title:", driver.title)
    print("Final URL:", driver.current_url)
    print("HTML characters:", len(driver.page_source))
finally:
    driver.quit()

Remove the accidental leading space before driver if you paste the snippet; the executable form is:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
driver = webdriver.Chrome(options=options)

The finally block matters on failures as well as successes: it closes the browser process and releases resources. For a visible debugging session, omit the headless argument.

Firefox headless

from selenium import webdriver
from selenium.webdriver.firefox.options import Options

options = Options()
options.add_argument("-headless")
driver = webdriver.Firefox(options=options)
try:
    driver.get("http://example.com")
    print(driver.title)
finally:
    driver.quit()

The historical Selenium recommendation specifically named Chrome and Firefox. Current Selenium documentation also lists other engines, but availability depends on your operating system and deployment image.

If you must understand an old PhantomJS script

Legacy code commonly looked like this:

from selenium import webdriver

driver = webdriver.PhantomJS()
try:
    driver.get("https://example.com")
    print(driver.title)
finally:
    driver.quit()

Do not treat that constructor as a supported installation recipe. Modern Selenium releases may not provide it, and PhantomJS itself is archived. Migration means replacing the WebDriver construction and options with Chrome or Firefox while keeping the navigation and cleanup pattern:

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")
finally:
    driver.quit()

HTTPS certificates and test environments

For a public HTTPS site with a valid certificate, no special Selenium call is needed. If a staging site uses an intentionally invalid or self-signed certificate, the browser may show an interstitial instead of the application. Do not disable certificate checks as a routine production fix: that hides TLS problems and changes browser security behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For an isolated test, use the selected browser’s current official configuration for accepting insecure certificates, document that the setting is test-only, and keep it out of production jobs. A certificate warning can also be caused by an incorrect system clock, missing trust-chain certificate, hostname mismatch or a corporate proxy; fix the underlying environment where possible.

Driver and browser management

Let Selenium Manager work first

Current Selenium documentation says Selenium Manager can discover the browser, obtain a compatible driver and cache it. In a normal internet-connected development environment, creating webdriver.Chrome() or webdriver.Firefox() is the preferred starting point.

When manual paths are appropriate

Some locked-down servers cannot download drivers, use a custom browser binary, or require centrally managed versions. In those environments, install the browser and driver through your operating system or image pipeline, then pass an explicit service or binary location according to the current Selenium API documentation. Manual-driver instructions found in older tutorials describe a legacy workflow and may use obsolete APIs.

Choosing a PhantomJS replacement

Decision factor Chrome or Firefox headless Other current Selenium engines
Rendering fidelity Uses a modern browser engine commonly used for web testing. Can better match a target deployment when that engine is supported.
Headless operation Supported through browser-specific options. Check the selected engine’s current Selenium and vendor documentation.
Driver setup Selenium Manager generally handles discovery and downloads. Manager support and installation requirements vary.
Deployment availability Depends on the browser package and OS image. WebKitGTK, WPEWebKit and Safari have narrower platform availability.
Compatibility Verify the Selenium, browser and driver versions together. Do the same; support changes between releases.

Choose the engine that matches the browser behavior you need to validate and that your CI or server can install reliably. There is no supported reason to select PhantomJS for a new project.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Common failures and precise fixes

“Unable to obtain driver” or Selenium Manager download errors

  • Cause: The machine cannot reach the driver or browser distribution service, or outbound traffic is restricted.
  • Fix: Allow the required network access, preinstall a compatible browser and driver in the image, or configure an approved internal mirror. Check current Selenium Manager documentation for your release.

Browser binary not found

  • Cause: Selenium is installed but Chrome or Firefox is absent, installed in a nonstandard location, or unavailable to the service account.
  • Fix: Install the browser in the runtime image and provide its documented binary location when necessary. Confirm the same user can launch it.

Driver and browser version mismatch

  • Symptoms: Session creation fails, the browser exits immediately, or Selenium reports an incompatible version.
  • Fix: Update the browser and Selenium Manager together, or pin a browser-driver pair supplied by your image. Record versions in CI logs.

Permission or sandbox errors in Linux CI

  • Cause: The job user cannot execute the browser, write its profile/cache, or use the required sandbox.
  • Fix: Correct filesystem ownership and runtime permissions. Use browser-specific container guidance rather than copying random flags; security-impacting flags should be isolated to the CI environment.

The page is blank, redirected or still loading

  • Print driver.current_url and driver.title after navigation.
  • Use explicit waits for a meaningful element instead of assuming get() means every JavaScript request has finished.
  • Check proxy, DNS, authentication, robots or bot-challenge behavior outside Selenium.

Or skip the browser setup

If your goal is a clean image or PDF rather than interactive browser testing, ScreenshotNeo provides a website screenshot API and MCP server. One GET request can return PNG, JPEG, WebP or PDF, while options cover full-page lazy-loaded captures, CSS-selected elements, device and viewport settings, retina scale, waits, custom JavaScript and CSS, cookies, headers, geolocation, blocking, resizing, caching and asynchronous jobs.

Example using the ScreenshotNeo API documentation:

curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups and chat widgets; each step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients. The Free plan includes 1,000 screenshots per month without a card; paid plans start at $5 for 3,000 shots. Create a free ScreenshotNeo account.

FAQ

Can Selenium still open an HTTP URL?

Yes. Pass the complete http:// URL to driver.get(); HTTPS uses the same method.

Is PhantomJS faster than Chrome?

The supplied authoritative material provides no current, comparable performance statistic. Speed depends on the page, browser options and environment, so do not use an unverified percentage to choose an engine.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Should I disable TLS verification to make a test pass?

No. Keep certificate validation enabled unless an isolated test explicitly requires an invalid certificate and follows the selected browser’s current documentation.

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.