Can I use a headless browser with Locust for load testing?

Hey everyone,

I’m trying to set up some load tests for a web app that has a lot of client-side scripts. These scripts kick off extra requests when the page loads, and I want to make sure my tests capture all that activity.

I’ve been looking into Locust for load testing, but I’m not sure if it can handle the client-side stuff on its own. Does anyone know if it’s possible to hook up a headless browser to Locust? That way, I could simulate the full user experience, including all those extra requests triggered by JavaScript.

If it is possible, any tips on how to get started would be super helpful. I’m pretty new to this kind of testing, so I’m a bit lost on where to begin. Thanks in advance for any advice!

yeah, headless browser and locust can teamwork. i used selenium webdriver to control it. you’ll need custom locust user code to drive the browser & capture its requests. it’s tricky and resource heavy but works well.

Absolutely, you can integrate a headless browser with Locust for more comprehensive load testing. I’ve done this using Selenium WebDriver with a custom Locust user class. It allows you to capture all those JavaScript-triggered requests you’re concerned about.

Keep in mind, this approach is more resource-intensive than standard Locust tests. You’ll need to write some custom code to handle the integration, and you might need more powerful machines to run tests at scale.

A useful tip: consider using a proxy like BrowserMob to intercept and log all browser requests. This gives you a complete picture of the interactions, including AJAX calls.

While it’s a bit more complex to set up, this method is excellent for testing the full user experience, especially with apps heavy on client-side scripting. Just remember, it’s slower than pure HTTP request simulation, so use it when you really need to test the complete user journey.

Absolutely! I’ve been down this road before, and it’s totally doable to use a headless browser with Locust. In my experience, Selenium WebDriver works great for this. You’ll need to write some custom code to integrate it with Locust, but it’s worth the effort. Here’s what I did: I created a custom Locust user class that controlled a headless Chrome instance via Selenium. This let me simulate real user interactions and capture all the JavaScript-triggered requests. It’s a bit more resource-intensive than standard Locust tests, so you might need beefier machines to run it at scale. One tip: use a proxy like BrowserMob to intercept and log all the requests made by the browser. This gives you a complete picture of what’s happening, including those tricky AJAX calls. Just remember, this approach is slower than pure HTTP request simulation, so it’s best for scenarios where you really need to test the full user experience. Good luck with your testing!