Recommended Free Tools
Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
PhantomJS WebDriver timeouts are not one problem with one setting. First identify whether the wait occurs while Grid is creating a session, after a session has gone idle on a Node, or while PhantomJS is loading a page resource. Each phase has a different owner and timeout. Fix the matching layer, verify the deployed versions, and change one setting at a time.
This guide uses the PhantomJS 2.1.1 command-line documentation and the older GhostDriver Grid integration path as references. Confirm the versions installed in your environment before copying commands; GhostDriver’s setup notes mention Selenium >= 3.1.0 as historical project guidance, not a compatibility guarantee for every current Grid/client combination.
1. Identify where the timeout occurs
Record the exact exception, timestamps, elapsed time, client-side timeout, and relevant Grid and PhantomJS log lines. Classify the failure before changing a value.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →| Observed phase | Timer owner | What it means | First check |
|---|---|---|---|
| Before a WebDriver session exists | Selenium Grid queue | The new-session request is waiting for a compatible, free slot. | Grid status, capabilities, Node registration, and --session-request-timeout. |
| After a session exists but no commands run | Grid Node | The established session has been inactive on its Node. | Gap between commands and --session-timeout. |
| During navigation or a page operation | PhantomJS page/resource layer | A resource request or page load is slow, failing, or blocked. | resourceTimeout, network/TLS behavior, proxy settings, and page callbacks. |
Do not raise all three timers together. A longer queue wait cannot create a matching Node, and a longer page-resource timeout cannot repair a Grid capacity problem.
#1 Best Overall
2. Verify the PhantomJS-to-Grid integration
Check the binary actually used
Run the version command in the same container, virtual machine, service account, and PATH used by the test:
phantomjs --version
PhantomJS troubleshooting also recommends checking that transfers work and that the runtime’s TLS/OpenSSL setup is sound. A different binary on a CI runner can make a locally successful configuration fail in Grid.
Start the embedded GhostDriver service and register it
PhantomJS exposes GhostDriver through its --webdriver option. The Grid Hub option works only together with it. The GhostDriver project documents this pattern:
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 reinstallOutdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchphantomjs --webdriver=8080 --webdriver-selenium-grid-hub=http://127.0.0.1:4444
Here, PhantomJS listens for WebDriver traffic on port 8080 and registers with the Hub at port 4444. Send your normal WebDriver client to the Hub, not directly to the PhantomJS process, and request the PhantomJS browser capability:
{"browserName":"phantomjs"}
Use the Hub, standalone server, or Router address appropriate to your Grid deployment. The command-line and GhostDriver documentation describe a legacy integration path, so validate that your current Selenium server and client still support the requested capability.
3. Fix a new-session timeout in the Grid queue
Inspect registration, slots, and matching
Query the Grid status endpoint at the address for your deployment:
Rank #2
curl http://127.0.0.1:4444/status
In Hub/Node mode this is normally the Hub address; in standalone mode use the standalone address, and in a fully distributed Grid use the Router address. Selenium documents GET /status as reporting registered Node state, sessions, and slots. Use it to answer three questions:
- Is the PhantomJS Node registered and healthy?
- Does it advertise a capability matching
browserName: phantomjs? - Is there a free slot, or are existing sessions consuming capacity?
If no Node matches, a longer queue timeout only makes the request wait longer. Correct the Node’s advertised capabilities, registration address, process startup, or available capacity instead.
Understand --session-request-timeout
Selenium’s current Grid CLI documentation lists --session-request-timeout as the maximum time a new-session request waits in the queue, with a documented default of 300 seconds. Defaults are version-sensitive, so inspect the CLI help and documentation for the server you deployed.
Increase this value only when a matching Node is expected to become available but legitimate queueing exceeds the deployed default. For example, a burst of parallel jobs may justify a longer wait; a permanently mismatched capability does not. After changing it, restart the Grid component that owns the option and retest with timestamps.
4. Fix an idle established-session timeout
Understand --session-timeout
The Grid CLI documents --session-timeout as the limit for a session with no activity on a Node, also with a documented default of 300 seconds. This is not a page-load timeout and not the queue’s new-session limit.
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 →Compare the time between the last successful WebDriver command and the next command. Long debugger pauses, human approval steps, downloads handled outside WebDriver, or test code waiting on another system can exceed the Node’s inactivity limit. Either keep commands flowing when that is safe for your test, shorten the idle portion of the workflow, or raise the Node’s session timeout to a value justified by the actual pause. Apply the change to the deployed Grid version and restart the relevant service.
Rank #3
Clean up abandoned sessions
When a test is cancelled, explicitly delete its session. Selenium documents session deletion as terminating the WebDriver session and removing it from the active-session map. A leaked session can consume a slot and make later requests appear to time out in the queue.
DELETE /session/<session-id>
Use your client’s normal quit or delete-session method in a finally block so cleanup runs after assertion failures as well as successful tests.
5. Fix a PhantomJS page or resource timeout
Configure resourceTimeout in milliseconds
Once a session exists, a delayed navigation can be a PhantomJS page-resource issue rather than a Grid issue. PhantomJS’s resourceTimeout setting is measured in milliseconds. When the interval expires, the resource request stops trying and the onResourceTimeout callback runs. The documented setting applies during the initial page.open call.
var page = require('webpage').create();
page.settings.resourceTimeout = 30000;
page.onResourceTimeout = function (request) {
console.log('Resource timed out: ' + request.url);
};
page.open('https://example.com', function (status) {
console.log('Page status: ' + status);
phantom.exit();
});
Set the value high enough for the resources your page legitimately needs, but do not use it to hide a DNS, TLS, proxy, server, or JavaScript failure. Log the URL and timing from the callback, then test the resource independently where possible.
Separate page loading from WebDriver command waits
A WebDriver client may also have its own command or script timeout. If the Grid session is alive and PhantomJS is still loading a resource, changing the client wait can mask the real page failure. Capture the client exception alongside PhantomJS’s resource callback and Grid logs so you know which timer fired first.
6. Check network, TLS, and proxy conditions
Verify transfers and certificates
PhantomJS troubleshooting calls out network transfers and TLS/OpenSSL setup as causes of apparent hangs. From the same host and runtime, verify DNS resolution, outbound connectivity, certificate validity, and access to every origin used by the page. A page that loads in a modern browser can still fail in PhantomJS because of its older rendering and TLS stack.
Rank #4
Use the Windows proxy workaround only when it matches
The PhantomJS troubleshooting documentation notes that a default proxy on Windows can add substantial network latency and documents:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minutephantomjs --proxy-type=none
Apply this only when the default-proxy condition is present and your network policy permits a direct connection. Disabling a required corporate proxy can turn a slow request into a failure and can bypass expected security controls.
7. A repeatable diagnostic procedure
- Capture evidence. Write down the failure phase, exception text, elapsed time, client timeout, Grid logs, PhantomJS logs, and timestamps.
- Confirm the runtime. Run
phantomjs --versionin the test’s actual environment and verify the process starts with--webdriverplus the correct--webdriver-selenium-grid-hubURL. - Check capability matching. Request
browserName: phantomjsand inspect/statusfor a registered, healthy Node with a free slot. - Classify queueing. If no session exists, compare the observed wait with the deployed
--session-request-timeout. Fix matching or capacity before increasing the wait. - Classify inactivity. If the session existed, compare the idle gap with
--session-timeoutand remove unnecessary pauses or adjust the Node setting. - Classify page loading. If navigation or a resource stalls, inspect
resourceTimeout,onResourceTimeout, TLS/OpenSSL, DNS, and proxy behavior. - Change one control. Retest in the deployed version, keeping the old value recorded so you can revert and tell which layer changed.
- Clean up. Ensure every test deletes its session, especially after failures, to prevent slot leaks.
8. Reliability, performance, and cost considerations
Longer timeouts trade faster failure for longer occupied resources. A queue timeout can leave CI jobs waiting while a Node remains unavailable; a Node session timeout can terminate a test during a legitimate pause; a resource timeout can keep a slot busy while an unreachable origin retries. Choose values from observed service-level behavior and workload, not from a universal recommendation.
Use /status before and during a capacity incident to distinguish an unhealthy Node from a full but healthy Grid. Keep startup commands, server version, client version, capabilities, and timeout flags in your deployment configuration so that a new runner does not silently use different defaults. PhantomJS is a legacy browser engine; if your application requires modern browser behavior, plan a migration rather than treating indefinite timeout increases as a compatibility strategy.
9. Or skip the browser setup
For teams that need rendered screenshots rather than a legacy PhantomJS test session, ScreenshotNeo provides a website screenshot API and MCP server. It accepts a URL and returns PNG, JPEG, WebP, or PDF. Before capture it accepts cookie or consent banners and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each cleanup step can be disabled. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and response headers report the page verdict and billing status.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
One GET request is enough:
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)
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}`);
See the ScreenshotNeo documentation for authentication and options. It also offers an MCP server with take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients. Features include full-page lazy-image loading, CSS-selector element capture, device presets and custom viewports, dark mode, retina scale, PDF controls, custom CSS/JavaScript, clicks, waits, request blocking, headers/cookies/user agents, timezone and geolocation, transparent backgrounds, resizing, TTL caching, signed links, asynchronous webhooks, bulk capture of 100 URLs per call, a usage API, and an OpenAPI specification.
The Free plan includes 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is on every plan. Create a free ScreenshotNeo account to try it.
Best Value
Frequently Asked Questions
Does increasing Selenium Grid’s session-request-timeout fix a PhantomJS page that hangs?
No. That option applies only while a new session waits in the Grid queue. A page-resource delay after session creation belongs to PhantomJS and its network path.
What units does PhantomJS resourceTimeout use?
Milliseconds. When the interval expires, PhantomJS stops trying the resource and invokes onResourceTimeout during the initial page.open call.
Why can a free Grid slot still produce a new-session timeout?
The slot may belong to a Node whose advertised capabilities do not match browserName: phantomjs, or the Node may be unhealthy or unreachable. Check /status and registration details.
Should I disable the proxy whenever PhantomJS is slow on Windows?
Only if the documented default-proxy condition matches your incident and direct access is allowed. Otherwise, disabling a required proxy can cause connection failures.
The Bottom Line
Fix PhantomJS Grid timeouts by matching the control to the failure phase: Grid queue, idle Node session, or PhantomJS resource loading. Verify versions, inspect /status, change one setting, and retest.
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.

