An Alfred Workflow for WebPageTest


By now, I have to be on record at least a few thousand times in saying that is an absurdly valuable tool. Pat gave the performance community an incredible gift by building it and making it available to the broader community for free.

I spend a lot of time in WebPageTest. A lot of time. A while back, I made myself a little Alfred (like Spotlight but significantly more powerful and useful) workflow to make it easy for me to fire off a test quickly. It’s nothing fancy, but it does make it very convenient.

When I want to run a test on WebPageTest for any URL, I can open Alfred (I use CMD + Space for the hotkey) and then start typing wpt. When I do, a few options come up:

  • wpt
    Test on a Moto G over a 3G network, from Dulles, VA (my most common test case, so I made it the default)
  • wpt:firefox
    Test on Firefox over a cable connection, from Dulles, VA
  • wpt:chrome
    Test on Chrome over a cable connection, from Dulles, VA
  • wpt:safari
    Test on Safari over a cable connection, from Dulles, VA
  • wpt:iphone
    Test on an iPhone 8 over a 3G connection, from Dulles, VA

For each option, I type in the URL I want to test, press “Enter” and my default browser opens and fires up a test. Of course, I still need to go to directly for a lot of testing, but these commands are great for quick off-the-cuff tests.

I have a couple of default options enabled for each test:

  • Number of runs: 3
  • Capture Video: true

The workflow is pretty straightforward. For each keyword (like wpt) it passes the query to an “Open URL” action which has all the options passed along in the query string.

Because the test gets passed to the public instance of by default, you need to use an API key (you can grab one for free courtesy of Akamai).

Since I decided to make the workflow available on GitHub, I didn’t want to hardcode the API key in the URL. Thankfully Alfred has some pretty slick environmental variables functionality that works perfectly for this. I also made the default run count and WebPageTest URL a variable, just in case anyone wants to default to a different number of test runs or use a private instance for testing.

As I mentioned, the workflow is up on GitHub for anyone who wants to take it for a spin. There’s a lot more I could do here—like make it possible to pass in the location or run count or some other variable dynamically—but it was meant to be a simple way to fire up WebPageTest quickly and for that, it has been working pretty well so far.