Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Scan for outdated or missing drivers - takes under a minute3Clear out junk files and repair common Windows errorsSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Short answer: Selenium opens HTTP and HTTPS addresses in the same way: create a WebDriver, call driver.get(url), inspect the page, and finish with driver.quit(). PhantomJS should not be your new default. Selenium’s 3.8.1 Python changelog states, “PhantomJS is now deprecated, please use either Chrome or Firefox in headless mode,” and the PhantomJS repository is archived read-only. For a maintained Python 3 setup, use a supported browser such as Chrome or Firefox in headless mode.
What happened to PhantomJS?
PhantomJS was a headless browser that older Selenium examples used because it could run without a visible desktop window. That historical code still appears in tutorials, but it is not a sensible starting point for a new project. The Selenium 3.8.1 Python changelog explicitly says: “PhantomJS is now deprecated, please use either Chrome or Firefox in headless mode.” The PhantomJS source repository was archived on May 30, 2023, so fixes and compatibility work should not be expected.
You may still need to understand PhantomJS when maintaining an inherited test suite. Treat it as a migration target: identify what the old script does, reproduce the behavior in a supported browser, and remove the PhantomJS dependency. Do not describe PhantomJS as a currently supported Selenium browser.
Free tools Windows power users keep installed
One-click scans. No signup required.
Prerequisites for a current Python 3 Selenium setup
- Python: Current Selenium Python documentation lists Python 3.10 or newer. Check the release documentation for the exact support range when you publish or deploy.
- A browser: Chrome, Edge, Firefox, Safari, WebKitGTK, and WPEWebKit are listed by the current Python documentation. Headless operation is available for the browsers that support it.
- An isolated environment: A virtual environment prevents Selenium and related packages from colliding with other projects.
- Network access during setup: Selenium Manager can discover, download, and cache a matching driver, but a locked-down build machine may need an approved installation process.
Create and activate a virtual environment
On macOS or Linux:
python3 -m venv .venv
. .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -U selenium
On Windows PowerShell:
py -3 -m venv .venv
..venvScriptsActivate.ps1
python -m pip install --upgrade pip
python -m pip install -U selenium
Pin the Selenium version after checking the current release that your organization supports. Avoid copying an old PhantomJS tutorial’s package pins into a new project.
#1 Best Overall
Open an HTTP or HTTPS URL with Selenium
HTTP and HTTPS are URL schemes passed to the same navigation method. There is no separate Selenium API for each scheme. The browser performs the network connection, redirects, rendering, and certificate checks.
Modern headless Chrome example
This complete script navigates to an HTTPS page, prints the resulting title and URL, and always closes the browser:
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def main() -> None:
options = Options()
options.add_argument("--headless")
options.add_argument("--window-size=1365,900")
driver = webdriver.Chrome(options=options)
try:
driver.get("https://example.com")
print("title:", driver.title)
print("url:", driver.current_url)
finally:
driver.quit()
if __name__ == "__main__":
main()
To open an HTTP destination, change only the URL:
driver.get("http://example.com")
The same get call also follows normal browser redirects. If an HTTP site redirects to HTTPS, inspect driver.current_url to see the final address.
Firefox headless variant
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("https://example.com")
print(driver.title)
finally:
driver.quit()
Choose the engine that matches the browser your users run. Fidelity to the production engine is usually more useful than preserving a PhantomJS-specific setup.
How HTTPS certificate handling really works
Selenium instructs the browser; it does not implement TLS itself. Certificate validation, protocol negotiation, mixed-content rules, proxy behavior, and interstitial warnings belong to the selected browser and its configuration.
- A valid public certificate should load normally.
- An expired, self-signed, hostname-mismatched, or otherwise invalid certificate may produce a browser warning page rather than the application you expected.
- A successful
driver.get()call does not prove that the page is safe or that certificate validation was bypassed; inspect the resulting page and URL.
Do not disable certificate checks as a routine workaround. If an isolated test intentionally uses an invalid certificate, configure the selected browser only for that test and consult its current official options. Keep such settings out of production automation, because accepting invalid certificates can hide deployment and security failures.
Selenium Manager versus manual drivers
Current Selenium documentation says Selenium Manager generally discovers, downloads, and caches the browser driver when you create a WebDriver. That is why the examples can use webdriver.Chrome() or webdriver.Firefox() without a hard-coded executable path.
Rank #2
Older guides often tell you to download a driver manually and pass its path. That remains useful when your company controls browser binaries centrally, outbound downloads are blocked, or a reproducible build requires an explicitly provisioned driver. It is a legacy-style workflow, not a requirement for every current installation.
When an explicit driver path is appropriate
- The browser is installed in a non-standard location.
- A CI image is built without Internet access and receives drivers from an internal artifact store.
- You must pin a tested browser/driver pair for a regulated or highly reproducible environment.
- Your platform policy prevents Selenium Manager from downloading binaries.
Pass the path using the browser’s current Selenium service class rather than copying an obsolete constructor from a PhantomJS tutorial. Keep the browser and driver versions aligned according to the browser and Selenium documentation you are using.
What old PhantomJS code looked like—and how to replace it
Legacy scripts commonly created a PhantomJS driver, called get, read a title or page source, and quit. The useful part of that flow is independent of PhantomJS:
- Create a WebDriver for a supported browser.
- Configure headless mode when a visible window is unnecessary.
- Call
driver.get("http://…")ordriver.get("https://…"). - Wait for the page state your test needs, then inspect elements, text, screenshots, or source.
- Run
driver.quit()in afinallyblock.
Replace PhantomJS-only assumptions—such as its old JavaScript engine, rendering quirks, or command-line flags—with behavior supported by the browser you select. A test that passes in PhantomJS is not automatically equivalent to one that passes in Chromium or Firefox; re-check selectors, timing, fonts, downloads, and security behavior.
Windows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstallCrashes, 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 minuteChoosing a replacement browser
| Decision factor | Chrome/Chromium | Firefox | Other Selenium-listed browsers |
|---|---|---|---|
| Historical Selenium recommendation | Named as a headless replacement in the Selenium 3.8.1 changelog | Named as a headless replacement in the Selenium 3.8.1 changelog | Not named in that historical sentence |
| Current Python documentation | Listed | Listed | Edge, Safari, WebKitGTK, and WPEWebKit are also listed |
| Best first question | Does your production site use Chromium behavior? | Does your production site use Firefox behavior? | Is the target browser available and supported in your deployment environment? |
| Driver setup | Selenium Manager can generally manage the driver | Selenium Manager can generally manage the driver | Verify current Manager and browser support for that platform |
| Headless use | Use the browser’s current headless option | Use the browser’s current headless option | Follow the selected browser’s current Selenium guidance |
There is no universal “PhantomJS replacement” independent of your compatibility target. Match the browser engine used in production, confirm it can run in your CI or container, and test the exact Selenium and browser versions you deploy.
Waiting, screenshots, and page state
A navigation call returns after the browser considers the document loaded according to its normal page-load strategy; client-side applications may still be rendering. For dynamic pages, wait for a meaningful element rather than inserting an arbitrary long sleep.
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
# after driver.get(...)
main = WebDriverWait(driver, 20).until(
EC.visibility_of_element_located((By.CSS_SELECTOR, "main"))
)
print(main.text)
Use an explicit wait for a selector, text, or state that represents readiness. This reduces flaky tests and avoids assuming that HTTP response completion equals application readiness.
Troubleshooting common failures
“Unable to obtain driver” or Selenium Manager cannot download
Cause: The machine cannot reach the download service, a proxy blocks the request, or the browser installation is not discoverable.
Fix: Confirm the browser is installed, check proxy and firewall policy, and provide a centrally installed driver when downloads are prohibited. Keep the driver compatible with the browser version.
Browser binary not found
Cause: The browser is absent, installed in a custom location, or unavailable inside the container.
Fix: Install the supported browser in the runtime image or configure its documented binary location. Verify the same user and environment that runs the Python process.
SessionNotCreatedException or version mismatch
Cause: The browser updated while the driver stayed older, or a manually supplied driver targets another browser version.
Quick wins for a faster PC:
Scan for outdated or missing drivers - takes under a minuteDriver Scan →Repair Windows errors before they cause bigger problemsFix Now →Fix: Record browser, driver, Selenium, Python, and operating-system versions. Let Selenium Manager resolve the pair where policy permits, or update the pinned pair together.
Permission denied, sandbox, or CI startup errors
Cause: The service account cannot execute the browser, write its profile/cache, or access required system resources.
Fix: Check executable and profile-directory permissions, use a writable temporary profile, and apply only the security settings required by your CI image. Do not copy random PhantomJS flags into a modern browser.
HTTPS warning page instead of the application
Cause: The certificate is invalid, the hostname does not match, a proxy is intercepting TLS, or the browser reached a security interstitial.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
Fix: Inspect the browser’s resulting URL and page text, correct the certificate or proxy configuration, and reserve any certificate-acceptance option for an explicitly isolated test.
HTTP page unexpectedly becomes HTTPS
Cause: The server, redirect policy, or browser security policy upgrades the request.
Fix: Read driver.current_url, inspect response behavior outside the browser if needed, and test the final scheme your application actually serves.
Performance and reliability practices
- Reuse a driver for a related sequence of pages, but quit it promptly when the job ends.
- Use headless mode in CI and set a deliberate window size so responsive breakpoints are predictable.
- Prefer explicit waits tied to application state over fixed sleeps.
- Capture browser and driver versions in CI logs so failures can be reproduced.
- Give navigation and waits finite timeouts; an unreachable host should fail a job rather than consume workers indefinitely.
- Use a clean profile for isolation, especially when cookies, extensions, or cached service-worker data can affect results.
- Test both HTTP and HTTPS when redirects, mixed content, authentication, or certificate handling are part of the requirement.
Or skip the browser setup
If your goal is a clean image or PDF rather than interactive browser control, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns PNG, JPEG, WebP, or PDF output. It accepts cookie and consent banners before capture and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled.
The Tool Desk
Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Only clean shots are billed. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits cost nothing, and the response identifies the result with X-Page-Verdict and X-Billed headers. Its MCP server exposes take_screenshot, get_page_info, and capture_pdf to Claude, Cursor, and other MCP clients.
See the ScreenshotNeo API documentation for the complete parameter list. This one-call example captures Stripe as WebP:
Best Value
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python
import requests
r = requests.get(
"https://api.screenshotneo.com/v1/shot",
params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"},
timeout=90,
)
r.raise_for_status()
open("shot.webp", "wb").write(r.content)
Node.js
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 includes full-page capture with lazy images loaded, CSS-selector element capture, dark mode, 12 device presets plus custom viewports, retina scale, PDF paper sizes and page ranges, HTML/CSS-to-image, custom CSS and JavaScript, click-before-capture, selector hiding, selector/delay/network-idle waits, request and resource blocking, custom headers/cookies/user agents and Authorization, timezone and geolocation, transparent backgrounds, resizing, chosen cache TTLs, signed links, asynchronous jobs with signed webhooks, bulk capture of up to 100 URLs per call, a usage API, an OpenAPI specification, and compatibility with parameter names used by other screenshot APIs.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; yearly billing gives two months free, and every feature is on every plan. Create a free ScreenshotNeo account to start without a card.
FAQ
Can Selenium still launch PhantomJS?
Older Selenium and PhantomJS combinations may run in a preserved environment, but the project is archived and Selenium deprecated it. Use that only to understand or temporarily maintain legacy code while migrating.
Does an HTTPS URL require a different Selenium method?
No. Pass the HTTPS address to driver.get just as you pass an HTTP address. The browser, not Selenium’s navigation API, handles TLS.
Should I use Chrome or Firefox for a migration?
Start with the engine that matches your production browser and deployment image. Both were named by Selenium’s historical deprecation guidance, and both are listed in current Python documentation.
Is a screenshot API a replacement for Selenium tests?
No. Selenium remains appropriate when you must interact with controls, assert application behavior, or exercise a user journey. An API is simpler when the deliverable is a rendered screenshot or PDF.
Frequently Asked Questions
What Python version should a new Selenium project target?
The current Selenium Python documentation lists Python 3.10 and newer; verify the supported range against the release you install.
Why does my HTTP test show an HTTPS URL afterward?
The server or an intermediary may redirect or upgrade the request. Read driver.current_url and test the final URL your application intends to serve.
The Bottom Line
Use Selenium’s supported Chrome or Firefox headless modes for new Python 3 automation. Keep the navigation code identical for HTTP and HTTPS, let Selenium Manager handle drivers where policy allows, and treat PhantomJS as legacy code to migrate rather than a current solution.
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.
Recommended Free Tools

