< Back to Blog Overview

Performance testing with Selenium

Frontend Performance Testing
  • Share on Facebook
  • Share on Twitter
  • Share on LinkedIn
  • Share on HackerNews
Chrome Devtools

With the release of TestingBot's Performance Testing, you can now retrieve various performance metrics from Chrome during your Automated Tests.

We fetch these various metrics from the Chrome browser via Chrome's Devtools Protocol.

TestingBot has added custom WebDriver commands which you can use to fetch metrics from the Chrome browser during your test, including:

  • Pageload Time
  • Number of HTTP(s) requests
  • domContentLoaded
  • firstPaint metrics

With this new feature, you can for example add checks in your Automated tests to verify if the Pageload Time is below a specific threshold.
If the Pageload Time is too high, the test will fail, alerting you that a performance regression occurred.

Please see our Frontend Performance Testing Documentation for more details on how to use this feature.

Sample Code:

require "rubygems"
require "selenium-webdriver"
require "selenium/client"

caps = {
  :browserName => "chrome",
  :version => "latest",
  :platform => "WIN10",
  :debugging => true

urlhub = "https://API_KEY:API_SECRET@hub.testingbot.com/wd/hub"
client = Selenium::WebDriver::Remote::Http::Default.new
client.timeout = 120

@webdriver = Selenium::WebDriver.for :remote, :url => urlhub, :desired_capabilities => caps, :http_client => client

@webdriver.navigate.to "https://testingbot.com/"
performance = @webdriver.execute_script("tb:performance")
assert performance["load"] < 900 # if the pageload time is below 0.9 seconds, fail the test.
TestingBot Logo

Sign up for a Free Trial

Start testing your apps with TestingBot.

No credit card required.

Other Articles

TestingBot and ScriptWorks integration: Codeless Automated Testing

ScriptWorks offers an online service making it easy to create automated tests without any coding knowledge.

Read more
The New Selenium IDE

The popular Selenium IDE recently got a much anticipated update. The Selenium IDE is an important feature in the Selenium ecosystem; it allows...

Read more
Black Friday and Cyber Monday Testing

Black Friday and Cyber Monday is the time of the year for many businesses, including e-commerce websites. During this period, the number of visi...

Read more
Testing with a Staging Environment - Continuous Deployment

In this article, we'd like to talk about how we at TestingBot make sure that new code that goes into production is tested thoroughly.

Read more
Automated and Live Testing in different Geographical Locations

We've added an option to our Live and Automated Testing platforms to specify from which country you'd like your test to run.

Read more
Automated & Manual Browser Testing on macOS Mojave

We're excited to announce that starting today, we've added macOS Mojave (mac 10.14) beta 5 to our list of available platforms.

Read more