Hello Readers!! It gives me immense pleasure in meeting you with yet another article on WebDriver. WebDriver has been creating a lot of buzz among the Selenium community lately and BrowserMob, an active member of the Selenium community, wasted no time in announcing its support for the WebDriver API.

I hope you had the chance to read the great introduction article on the Webdriver API by fellow blogger Ben.

In this article I would like to touch on the basics of scripting with the WebDriver and the BrowserMob API.
I’m sure many of you, who are new to this API are asking yourselves these questions just like I did.

Select any time coordinate in your test plan and simply add a comment in the annotation field.  Your annotations are tracked and numbered with a flag, so to review, simply reference the number on the flag in the list of annotations made for that test plan.  Don’t worry about making mistakes, you can delete an annotation at any time.

Hello Readers!! Welcome back to Part 3 of our Load Testing Best Practices series, which focuses on writing good load testing scripts.

As I’m sure you would agree to, load testing is an imperative part of every development effort. One of the key components to your load testing efforts is a good load testing script that simulates real user behavior on your web site in the most realistic and accurate way possible.

Before you take a deep dive into the scripting, there are few things you need to plan ahead of time.

Occasionally, users may want to conduct a load test using cached pages. BrowserMob offers this ability through scripting using RBUs. Typical behavior of a RBU is to the run the script once, close the browser, clear the cache, and start over. To prevent the browser from closing and the cache from being cleared, the steps of the script are placed in a loop.  The loop encases everything between browserMob.beginTransaction(); and browserMob.endTransaction(); which leaves the browser open and prevents the cache from being cleared until the final iteration of the loop and the end of the script.

As you build out your script and plan for a successful load test, it’s important to design the script that incorporates timeout values. BrowserMob has a few types of timeouts that you can use: HTTP-level, Selenium page-level, and Script-level timeouts.

HTTP-level timeouts are controlled by the HTTP client, usually the “c” variable. var c = browserMob.getActiveHttpClient(); and there are 3 commands relating to HTTP timeouts: setConnectionTimeout, setRequestTimeout, and setSocketOperationTimeout.  For more information, check out our API documentation which outlines each of these commands.

selenium.waitForElementPresent(“myelement”);

The waitForElementPresent commands polls the page waiting for the specified element to load. If you are familiar with Webmetrics/WATIR scripting, the command is very similar to the wait_until() command. The waitForElementPresent command is most often used on sites containing dynamic content such as Ajax, JavaScript, etc. Scripts are designed to execute as quickly as possible and Selenium tends to fire steps faster than the DOM can render changes, causing issues/errors with the script playback.

There are a few ways to determine if you need this command:

The first is to check the playback in SeleniumIDE:

Setting up your load tests with a blend of RBUs and VUs can be ideal but it does depend on the type of scripts you are running.  Does your script require the user to fill out a form or does the site use AJAX? For those instances, RBUs work best. If your script is about browsing the site as a read-only, VUs work just as well; plus saves you money. VUs is simply HTTP and may be harder to script (but 1/10th the price!).

Hello Readers, Welcome Back !!

As the first part of this Selenium Tips series, this article intends to summarize the different ways to interact with dynamic sites that refresh content asynchronously wherein the script will have to wait for certain elements to appear or disappear before proceeding further. As you are already aware of, Selenium has several ‘waitFor’ commands that fulfill this purpose. waitForCondition is one among them. ‘waitForCondition’ basically takes in two arguments, a JavaScript snippet and a timeout period in milliseconds. The snippet is executed either until it returns true or until the timeout period, after which the command will return an error. Now enough of theory and let’s get into action.

While we support Selenium as our core API and Selenium is a popular functional testing toolkit, we do not currently support running tests written in languages like Java/C#/Ruby/Python/etc. There are two reasons we don’t support general unit test-style tests:

First, Often these kinds of tests contain references to resources that aren’t accessible when running the test in the cloud. For example, we’ve seen tests that have hard coded URLs (ie: http://localhost:8080) and reference databases and web services to verify backend functionality.

Hello Readers, Welcome back!!

This article intends to explain a few ways of using regular expressions with BrowserMob and Selenium. As we all know already, regular expressions are extremely helpful in scripting dynamic web sites, especially when you run into situations such as picking the first product from a dynamic list of products, clicking on the last link of a dynamic drop-down etc.

To begin with, let’s see a couple of examples for using regular expressions with BrowserMob’s VU (Virtual User) scripts. Not sure what VU is? Check it out here or contact BroserMob Support at anytime.

© 2012 The BrowserMob Blog Suffusion theme by Sayontan Sinha