I’m working on testing a web app that uses lots of AJAX calls. Need to set up automated tests that can run without anyone watching them. Want to use the same test scripts for both performance testing and regular functionality checks.
Right now I’m using JMeter for load testing. We record the HTTP requests and then spend tons of time fixing them to handle all the async stuff. This works okay but the scripts break easily when developers change things. I need something that can control a real browser through code but without showing any windows or graphics.
Tried running Chrome with Xvfb on Linux but it still uses way too much memory and CPU even without displaying anything. Also tested Selenium with headless Chrome but had similar resource problems.
Spent a lot of time with Puppeteer recently since it seemed perfect for this. Writing test scripts in Node.js so I can integrate with our existing test framework. But I keep hitting JavaScript issues that don’t happen in real browsers and I think this approach isn’t going to work.
I know about other options like PhantomJS and Playwright but not sure how mature they are. Don’t want to spend another week going nowhere.
How difficult would it be to modify Chromium or Firefox source code to remove all the display and UI parts to make a true headless version? Has anyone done this before? Which browser would be easier to modify? I’m surprised this doesn’t exist already so maybe it’s way harder than I think.
If I could get a real headless browser that doesn’t use too many resources I think that would solve my problems. I have plenty of servers but not enough for full GUI browsers.
phantomjs is dead - don’t waste ur time. i switched to playwright after hitting the same probs. memory usage dropped big time once i added --disable-dev-shm-usage and --no-sandbox flags. parallel tests actually eat less memory per test than running them one by one - v8’s garbage collection works better that way. those ajax timing issues sound familiar. try bumping up ur default timeouts before u jump to another tool.
Playwright’s gotten really mature and handles AJAX way better than Puppeteer. Microsoft’s thrown serious resources at it and the API’s much cleaner for testing. Cross-browser support is excellent - no more timing issues like you get with Puppeteer.
For resources, use browser contexts instead of spinning up full browser instances. One browser can run multiple contexts at once, which cuts memory usage big time. We’re running 20 concurrent test contexts on a single browser without issues.
Your JMeter scripts breaking? That’s gonna happen with HTTP-level testing on modern web apps. The maintenance overhead kills you. Browser automation pays for itself just in the time you save not fixing broken scripts, even if it uses more resources.
Don’t modify browser source code - trust me on this. I wasted months trying to strip down Chromium for a similar project and it was a complete nightmare. The display components are so tangled up with the JavaScript engine and DOM that removing them breaks everything.
Try Firefox headless instead of Chrome. It uses way less memory, especially with AJAX-heavy apps. We saw about 40% less memory usage in our tests. You can still use Selenium WebDriver with it.
For those Puppeteer JavaScript issues - they’re usually timing problems with async operations. We fixed most of ours by adding proper wait conditions instead of fixed delays. The page.waitForResponse() method works great for AJAX calls.
Also worth trying: Docker containers with resource limits. We run headless browsers in containers with strict CPU and memory caps. Forces better resource management and makes tests way more predictable.