22
Selenium IDE 1.0.4 Released
0 Comments | Posted by Patrick Lightbody in Announcements, Industry News
We’re happy to report that Selenium IDE 1.0.4 has been released. You can download it here and you can find the release notes here.
While this release doesn’t have many new user-facing features, it does clean up several bugs. More importantly, however, is that Adam Goucher and Jérémy Hérault did some amazing work to lay the foundation for a plugin framework. This means that soon you’ll see Selenium IDE plugins that further expand the Selenium IDE capability.
Jérémy is working on one such plugin, called Helenium (see proof of concept in action), that will allow you to do text matching against images and PDF files using optical character recognition (OCR). We’re also working on a plugin that will make it easier to upload scripts from the IDE to BrowserMob.
If you’re interested in how to build your own plugin, I recommend reading Adam’s blog, which has a series of recent posts on how the plugin framework works.
20
New Features: A new cloud location, Selenium 2 support, UI improvements, and new APIs
1 Comment | Posted by Patrick Lightbody in Announcements
We’re always working hard to improve our BrowserMob monitoring and load testing services. Over the last few weeks, we’ve pushed pushed out a bunch of improvements:
New Monitoring and Load Testing Location
Hot off the heels of Amazon’s announcement of a new US West Coast cloud data center, we are happy to report that you can now schedule load tests and monitoring jobs from this new location. Simply select the “San Jose, CA” location when scheduling tests.
Selenium 2.0 Support
In December, Selenium 2.0 alpha 1 was released. This release dramatically improves the realism and reliability of Selenium scripts. We’re proud to say that you can try out Selenium 2.0 support (but keep in mind it’s still in alpha) by simply changing your selenium script from this:
var selenium = browserMob.openBrowser();
To this:
var selenium = browserMob.openBrowser(true);
We will continue to keep BrowserMob up-to-date with all the latest happenings in the Selenium world, as well as donate our time and code back to the Selenium project. We also upgraded all the BrowserMob browsers to have the latest version of Firefox (3.5.7) and Flash.
Schedule Load Test UI Improvements
We’ve also made scheduling a load test a lot easier. We now give you a realtime estimate of what the test will cost you, changing dynamically based on your test configuration. We also display tooltips explaining things like “location”, “ramp”, and “constant”. Finally, we’re really excited to have rolled out a “Run ASAP” option that will kick off the test as quickly as it can, usually within 10 minutes.

New Script Editor
Our users love that they can write their scripts using JavaScript, so we decided to make working on that JavaScript code even easier. By utilizing the Bespin open source project from Mozilla, you now will see a rich text editor with code syntax highlighting. If for some reason you’re having trouble with it, you can always switch back to the plain text editor.

New Load Test Charts
We’ve always been proud of our realtime load test charts, but some users had recently complained that they were too heavy-weight and were slowing down their browser. Of course, this is a perfect example of why performance in the browser is starting to matter just as much as performance on the server.
Responding to this complaint, we rewrote the charts from scratch, moving from YUI Charts (Flash-based) to Flot (Canvas-based). We hope you like them!

New Scripting API Improvements
If you do advanced scripting, especially with virtual users, you’ll definitely want to take a look out the BrowserMob scripting API. We added a whole bunch of useful functions, including:
- setFollowRedirect(true) now logs all intermediate HTTP requests
- You can now automatically verify response codes
- If a 3xx response code is returned when you expected something else, the Location header is logged
- You can tie in “interceptors” for both HTTP requests and HTTP responses, allowing very advanced scripting techniques
19
Google search results to favor sites with better performance?
0 Comments | Posted by Patrick Lightbody in Uncategorized
Over the last few months Google has continued to focus on performance as a key message to developers. From their “Let’s make the web faster” initiative on Google Code, to their public DNS service, to the constant focus on performance by their Chief Performance guru, Steve Souders, it’s clear that Google wants people to have a faster experience on the web.
This makes sense: the faster the web, the more people will use it and be more likely to search and click on ads. In fact, in an interview with Web Pro News in November last year, Matt Cutts (head of Google’s webspam team) casually mentioned that in 2010 Google may give search ranking preference to sites that load faster. Om Malik went on to discuss whether this was a good idea or not.
More recently, Google opened up a new “Labs” feature in their Google Webmaster Tools that actually shows you the performance of your site as measured by the Googlebot. This move is further evidence that Google is indeed going to shift to making performance part of it’s ranking routine if it hasn’t already. See a screenshot of what you can expect to see:

In addition to the above chart, there is also some basic analysis and recommendations on how to improve performance, similar to what Page Speed and YSlow recommend. While it is a good start and provides the clearest view of how Google perceives your site’s performance, the data is still rather basic.
As such, when measuring and optimizing page load times we’d still recommend you work with a more in-depth tool such as Page Speed and YSlow. And, of course, for website monitoring and website load testing, we’d have to recommend BrowserMob ![]()
Brad Feld, an early stage investor and entrepreneur who runs the popular blog Feld Thoughts, recently dug up an old video showing how things have come almost completely full circle in the world of computing.
The video is embedded below for your convenience. It’s a bit long (~30 minutes), but if you’re interested in today’s cloud computing, it’s pretty entertaining to watch. It definitely gives you a good perspective on the evolution of computing:
20
Bypassing analytics, advertisements, and other third parties in BrowserMob
0 Comments | Posted by Patrick Lightbody in Uncategorized
Often when it’s time to run a load test or turn on website monitoring, you don’t necessarily want the transaction hitting all your third party components on the page.
For example, you don’t want your analytics software to record the visits as real visitors, since that would skew your marketing metrics. Likewise, you don’t necessarily want advertisements served up, especially if the ad vendor uses “click-through rates” (CTR) to optimize ad prices and a load test would artificially drive down the CTR.
While there are vendor-specific actions you can take to deal with this problem (ie: we cover Google Analytics here), sometimes the easiest solution is to modify your script so that the request is never made in the first place.
You can do this for both Real Browser User (RBU) and Virtual User (VU) scripts using some new APIs that we recently rolled out. They allow you to whitelist or blacklist certain hosts from having actual HTTP requests sent to them.
For example, suppose you want to exclude all requests to www.google-analytics.com from your website monitoring or website load test. Your script would need to do something like this:
var selenium = browserMob.openBrowser(); var c = browserMob.getActiveHttpClient(); c.blacklistRequests("http://www\\.google-analytics\\.com/.*", 200); browserMob.beginTransaction(); browserMob.beginStep("Step 1"); // rest of test...
This would ensure that any HTTP request to Google Analytics would be bypassed immediately and a fake 200 response code would be returned instead.
Sometimes it’s easier to whitelist “good” hosts instead of blacklisting specific ones. This is often the case for advertising networks, which tend to host content from dozens of different domains.
var selenium = browserMob.openBrowser(); var c = browserMob.getActiveHttpClient(); c.whitelistRequests(["http://www\\.example\\.com/.*", "http://images\\.example.com\\.com/.*"], 200); browserMob.beginTransaction(); browserMob.beginStep("Step 1"); // rest of test...
In this example, we are allowing all requests to www.example.com and images.example.com to go through, but faking any other request with an immediate 200 response code.
These whitelist and blacklist APIs are just one example of the powerful scripting you can do using the BrowserMob API and scripting environment. We encourage you to review the entire API documentation from time to time, as well as contact us if you ever have questions about them.
16
FAQ: How do I run a load test against a website hosted in Amazon EC2?
0 Comments | Posted by Patrick Lightbody in Uncategorized
Often when someone wants to test a site that isn’t yet ready for public release, they will use various security measures to keep the general public from looking at it. Sometimes they will use BASIC authentication and other times they will use firewall rules to only allow certain IP addresses access to the site.
However, as we continue to see a growing trend of BrowserMob customers who are deploying websites in the Amazon cloud using EC2, we wanted to highlight that the firewall technique does not work using our service.
The reason is that BrowserMob also runs in the Amazon cloud and as such is able to access the customer website across it’s private network. Because of this, the incoming IP address is not one of the ones we have documented, but a random internal-only IP that we do not know about ahead of time.
Fortunately, there is an easy solution: set up your EC2 network security to allow our Amazon “user ID” direct access through the port your website is hosted on. Simply authorize the User ID 581518868128 in the appropriate EC2 Security Group.
For example, If you are using Elasticfox, go to the Security tab and add a new permission for the appropriate Security Group. It should look like this:

Once done, you should be able to run your load test just fine. We do recommend running a small scale test first to confirm it works before running the larger test. If it’s not working, every request will result in a timeout.
We hope that helps, and we look forward to continuing to work with more companies making the transition to the cloud!
11
Tom Pinckney on how to survive the Slashdot effect
0 Comments | Posted by Patrick Lightbody in Uncategorized
Tom Pinckney, co-founder of Hunch, recently prescribed some tips on how to survive being Slashdotted. While Slashdot is no longer the biggest online driver of spikes of traffic, there was a time when it was the king of bringing down sites: a simple mention of a URL on the home page would crush most servers.
These days sites like Yahoo, Digg, and Drudge Report often carry much more weird, but Tom’s lessons apply to any situation where you are going to get a huge spike in traffic (expected or otherwise). There’s a lot of good stuff in Tom’s post, as well as previous one about achieving “consistent performance” that are well worth a read.
Perhaps the best advice Tom gives is:
If using Apache, use worker MPM with MaxClients and ServerLimit as high as you have RAM for. Better to cap max # of threads and reject some users than let the whole machine go down.
This is an important point people often forget: eventually you will fail, so better plan to fail gracefully.
8
Selenium, BASIC authentication, and how to get it to work in BrowserMob
0 Comments | Posted by Patrick Lightbody in Uncategorized
BASIC authentication is used to provide minimal, low-security protection from anonymous visitors hitting your website. It is frequently used by companies to ensure that their staging or development environments are not accessibly by the general public prior to pushing the changes to production. Typical authentication dialog prompts look like so:

The challenge here is that this dialog box is the kind of dialog that Selenium cannot automate. You cannot issue “type” or “click” commands on it. In fact, if this box comes up, your script is guaranteed to time out because Selenium will continue to wait for the page to load, not realizing a login is required and unable to populate it.
Traditionally Selenium users have worked around this problem by using a URL pattern in which the username and password was encoded:
http://username:password@example.com
Recently, however, this is not working across all browsers. IE no longer supports it and recent versions of Firefox add a confirmation box that breaks the automation with a slightly different popup. And while we’re working on as solution for Selenium 2.0, there aren’t a lot of options for Selenium today.

But when it comes to BrowserMob, we do have a solution available today, which will be soon back-porting to the Selenium 2 codebase. Simply edit your script to look like the following:
var selenium = browserMob.openBrowser(); var c = browserMob.getActiveHttpClient(); c.autoBasicAuthorization("example.com", "username", "password"); browserMob.beginTransaction(); browserMob.beginStep("Step 1"); selenium.open("http://example.com"); // rest of script...
This code tells BrowserMob to automatically put in the required Authorization headers for any HTTP request issued to example.com. And soon this capability will be added to Selenium 2 (after we get the first alpha out in time for the holidays).
7
FAQ: What’s the difference between a Real Browser User and a Virtual User?
0 Comments | Posted by Patrick Lightbody in FAQ
At BrowserMob we have two different levels of load testing support: one for Real Browser Users (RBUs) and one for Virtual Users (VUs). Often it’s not immediately clear what the difference is and why you’d use one over the other.
RBU Benefits
The high level difference is this: an 100 RBU test means that there will be 100 browsers in the cloud all loading your site and interacting with it, while a 100 VU test means that there will be 100 “threads” issuing HTTP GET and POST requests to your website, but not actually running a browser. This means that RBUs:
- Check functionality – they don’t just make HTTP requests, they validate if the application is actually working as an end-user would expect it to.
- Provide better error reporting – because there is an actual browser on a desktop running, we can take a screenshot to show you what the failure looked like.
- Are more realistic – today’s browsers load up to 15 objects at a time and have very unique HTTP request patterns that are almost impossible to simulate without a real browser.
- Use a wide range of IP addresses – because RBUs need a lot of resources, we allocate between 1 and 6 browsers per IP.
- Can measure real user wait time – sometimes the UI can’t be used until multiple overlapping AJAX calls are finished. Only a real browser can tell you when the UI is ready for interaction.
RBU Cost
When it comes to load testing website applications, RBUs are superior in almost every way. However, with all that realism and IP address distribution comes a massive hardware requirement: for every RBU in a test we allocate a full CPU core and 1.5GB+ of RAM. That means that a 100 RBU test requires at least 100 CPU cores and 150GB of RAM.
Compared to traditional load testing, which only requires half a CPU core or less and 256MB of RAM, it’s very different. This resource-hungry nature of RBUs means that they cost 10X more than our Virtual User service. That means a 100 RBU test will cost the same as a 1000 VU test. As such, depending on your budget, it may make sense to use a mixture of RBUs and VUs.
Scripting Effort
While RBUs are more realistic but cost a bit more, it also helps to understand the level of effort to write and maintain RBY and VU scripts. Remember that RBU scripts interact at the application level, while VU scripts interact at the protocol level.
Consider this RBU script:
var selenium = browserMob.openBrowser(); selenium.open("http://google.com/"); selenium.type("q", "BrowserMob"); selenium.click("btnG"); selenium.waitForPageToLoad(30000); if (!selenium.isTextPresent("BrowserMob")) { throw "BrowserMob text not found"; }
Written as a VU script, each and every HTTP request would need to be scripted:
var c = browserMob.openHttpClient(); // get the home page and verify we got a 200 OK c.get("http://www.google.com/", 200); c.get("http://www.google.com/intl/en_ALL/images/logo.gif"); c.get("http://www.google.com/extern_js/f/.../Y3ut8jJ-OXk.js"); c.get("http://www.google.com/extern_chrome/be5ffa94030d2d34.js"); c.get("http://clients1.google.com/generate_204"); c.get("http://www.google.com/images/nav_logo7.png"); c.get("http://www.google.com/csi?v=3&s=webhp&action=&e=...&rt=..."); // simulate the AJAX event for the Google auto-complete // also verify a 200 OK response c.get("http://clients1.google.com/complete/search?hl=en&client=hp&q=BrowserMob&cp=27", 200); // simulate searching // also verify a 200 OK response var resp = c.get("http://www.google.com/search?hl=en&source=hp&q=BrowserMob&btnG=...", 200); // get the other requests caused by the new page load c.get("http://www.google.com/images/nav_logo7.png"); c.get("http://id.google.com/verify/EAAAAECIWFsnXJixiQogbBCZlzA.gif"); c.get("http://www.google.com/csi?v=3&s=web&action=&ei=slYdS_-MGpXKsAPngsX8BA&e=..."); c.get("http://clients1.google.com/generate_204"); // finally, validate the browsermob was in the main HTTP request if (resp.getBody().indexOf("BrowserMob") == -1) { throw "BrowserMob text not found"; }
When to Use Virtual Users
As you can imagine, writing and maintaining VU scripts is a lot more work. However, that doesn’t mean VUs are always a bad idea. In fact, they are great for:
- Placing a large amount of low-cost “dumb” load on a website. For example, when trying to saturate simple hits again a home page.
- When testing a web service, such as REST or SOAP, that can’t be directly tested with a web browser.
- When budget constraints require VUs
As a general rule of thumb, if your own hourly cost to write a VU script is more than it would be to quickly run an RBU test, you should probably go with an RBU. However, if it’s an extremely large scale test, VUs may be worth considering for a good portion of the load.
Don’t Forget!
Finally, don’t forget that there is no reason you can’t run two load tests at the same time:
- A smaller RBU test that lets you measure what the real user experience is like
- A larger VU test that hammers at the site in a cost-effective way
This technique allows you to stay within your budget without giving up entirely on the benefits of RBU scripts.
7
Flash and Flex automation options using Selenium
0 Comments | Posted by Patrick Lightbody in FAQ
We get a lot of customer requests about Flash automation, Selenium, and BrowserMob. Because our load testing and website monitoring services uses real browsers, complete with Flash 10, we can do things no one else can do, like run a load test with hundreds of Flash runtime environments driving traffic on your site.
However, while our infrastructure allows for extremely unique Flash testing support, it’s not perfectly streamlined (yet). While we are hard at work on making Flash support for Selenium and BrowserMob significantly better, at this time some work is required by Selenium users before you can get started.
Specifically, the first question that must be answered is: what automation technique do I want to employ? There are two distinct ways to go:
- Native mouse & keyboard integration – good for situations where there is minimal Flash interaction required
- API-level integration – good for situations where there is a lot of Flash interaction required
Native mouse & keyboard integration
Let’s talk briefly about native integration. This is where a mouse movement, mouse click, or keyboard action is simulated at the operating system level. It reproduces the most realistic user simulation. However, it can be very brittle, as it has limited ways to “read” from the screen and validate that functionality worked correctly.
Presently there is no great Selenium-only solution here. There are commercial functional testing products such as eggPlant, but nothing on the load side of things. BrowserMob does have, however, the ability to interact with the operating system using native key events and coordinate-based mouse interaction.
This feature is perfect for those who want to fire off one or two simple interactions, such as clicking on a movie’s “play” button or interacting with a confirmation dialog. If this is all you need for your Flash or Flex integration, please contact our support team and we’ll gladly help you get your script working using this unique API.
API-level integration
For applications that have much more complex Flash/Flex user interfaces or applications that are 100% Flash-based, we don’t recommend native events as they can be brittle and difficult to confirm that the desired functionality worked. Instead, we recommend interacting with your Flash applications using API-level integration.
Important: to do this type of automation you must be able to recompile/modify the underlying Flash object(s). If you cannot do this and require full “black box” style automation, we suggest you consider native automation or you consult with the authors of the original Flash component.
How you proceed from here depends on whether you are using Flash or Flex. The reason is that Flex exposes some automation APIs that you will otherwise have to reproduce if you are using Flash-only.
Flash automation with ExternalInterface
If you are using low-level Flash, your automation options are a little more limited:
- Using ExternalInterface directly – no 3rd parties, but might requires the most programming
- Using FlashSelenium – an open source library to make ExternalInterface callbacks easier to call
We recommend you first start off with ExternalInterface directly, as FlashSelenium is really just a thin wrapper around ExternalInterface. While it’s convenient, we think doing it by yourself once is an important learning experience.
To get started, we recommend reading the ExternalInterface documentation by Adobe. The basic idea is that within your Flash component you execute this code:
ExternalInterface.addCallback("doSomething", doSomething);
This exposes the function doSomething such that it can be executed by JavaScript. Fortunately, because Selenium can execute JavaScript using the getEval, storeEval, assertEval, etc commands, we’re in luck:
var jsExpr = "window.document.getElementById('myFlashObjId').doSomething()"; var something = selenium.getEval(jsExpr); if (something == 'blah') { // throw an error, we weren't expecting 'blah'! }
Using this technique, you can begin to expose ActionScript functions that can be used to automate the Flash component and validate that the right behavior took place.
Flex automation with Selenium-Flex
If you’re using Flex, automation should be quite a bit easier. Thanks to Selenium-Flex, you don’t have to spend time exposing dozens of functions via ExternalInterface. Instead, just compile your Flex application using the Selenium-Flex library:
- Copy the sfapi.swc file in to your project (ie: the lib directory)
- In your IDE/build system, ensure that the library is included (ie: -include-libraries)
That’s it! Now the next time you build your Flex app it’ll automatically have a whole bunch of functions already created. Even better, you don’t have to do all that getEval mumbo-jumbo we did for Flash testing. Instead, thanks to another open source project called FlexUISelenium (which works in concert with Selenium-Flex), the getEval stuff is abstracted away so that your tests look like this:
flex.type("2").at("arg1"); flex.type("3").at("arg2"); flex.click("submit");
If you’re doing functional programming using Java or some other full-blown programming language, you can get started with FlexUISelenium today. If you’re looking to load test or do website monitoring with Selenium, we are in the middle of adding FlexUISelenium support to the BrowserMob API. We are looking for beta participants right now, so contact us if you’re interested.
A note about recording support
Currently, none of the open source solutions referenced here support recording interactions from within Selenium IDE. While not Selenium-compatible (yet), FlexMonkey is a very good open source Flex record and playback functional testing framework. We have plans to integrate Selenium and FlexMonkey in the future, including record support through Selenium IDE.
In the meantime, you will need to write each Selenium command by hand. This means that you’ll need to be aware of the IDs of all the elements you wish to interact with. Once you know those IDs, you can write the code that issues clicks or types on the component.
