Navigations are a kind of item in Badboy that records clicks or activation of user interface elements in the browser window. When you record a navigation, it finds the browser element that was clicked on (or navigated in another way, for example, by hitting space or enter) and remembers it. When you play back, Badboy finds the same element again and simulates a click on it again so that the browser performs the same navigation again.

Recording Navigations

By default, Badboy records Requests instead of Navigations. However you can easily switch recording modes at any time to record Navigations instead. You can do this by the following methods:

  • Click the 'N' button on the Toolbar to toggle between modes
  • Press Ctrl-Alt-N to toggle between modes
  • To switch modes while recording just a single item simply hold the Control and Alt keys down while clicking on or navigating the page. This will change the record mode only while you hold the keys down.

Types of Navigation Items

Badboy will record different kinds of Navigation Item in your script depending on what kind of element you click on and also how that element is represented in the page you are recording. The table below shows the three different kinds of item you will see:

Navigation Type Description
Represents a click on a link. This may be any kind of link including an image link or other non-textual content.
A click on a button. These are usually buttons in forms such as Submit buttons.
A click on a miscellaneous item on the page. Frequently these occur when the page has used JavaScript to respond to "onclick" clicks on page elements resulting in a page navigation or a form submission.

Navigation References

Web pages can often change quite significantly in their layout, size and shape, and can often have many elements that look or appear the same. Because of this, Badboy uses several different ways of identifying elements in order to ensure that it finds the correct one that you originally recorded when playing back. The information that Badboy uses to identify the element is called the "Reference" to the element. When you record a click on an element, Badboy uses the following logic to find a reference for it:

  • If it has an id then it will record the id of the element
  • If it has a unique name assigned then it will record the name
  • If it is a link or a button and has distinctive visible text (such as the label on the button) then it will record the text and identify the item via it's text
  • If none of the other methods apply, it will identify the element by it's position in the browser DOM, using a JavaScript expression.

Navigation Properties

If you wish you can open the properties of the Navigation and set the reference information yourself. The figure below shows how the properties dialog looks:

The following table describes the different properties you can set:

Property Description
Element Reference This identifies the element to be navigated. How this text is interpreted depends on the Reference Type.
Element Type Determines how the reference text is used.
  • For Visible Text, the reference is interpreted as the label or visible page content that the element displays (eg. the displayed content for a link, the text on a button or a tooltip describing the item).
  • For Id/Name, the reference is interpreted as an id or name set on the element to be navigated.
  • If you choose "JavaScript Reference", Badboy will execute the text as Javascript which should return the item to be navigated. You can use this to write more complex logic to find the element to be navigated.
Element Filter Sets the kind of elements that should be considered for matching the reference text. This helps make sure Badboy chooses the correct element by screening out all elements that do not match the filter. You can choose "Links", "Buttons" or "All Elements"
Index Causes Badboy to use the specified occurrence of the matched element on the page. For example, if there are three buttons named 'Logout' on the page, you can make Badboy use the third one by specifying "2" in the Index property. Note that this property is "zero-based", so the first occurrence (the default) is specified using "0" and the second is specified using "1" and so on.
Use Regex Match Causes the Navigation to treat the Reference as a regular expression when attempting to match elements on the page. This is useful if the element you wish to navigation changes for each playback but has a definable form that you can describe with a regular expression. This option only applies to the "Visible Text Reference" reference type.

If you are having problems getting your navigation to locate the right element you can right click on the Navigation and choose "Highlight Element" to show which element on the page will be targeted. If it targets the wrong one then you can increment the "Index" option in the properties to cause it to find the next item in the page until it finds the correct element.

Auto-Record of Form Populators

When pages contain fields that allow the user to enter information you will usually want any changes that are made to the fields to also be made when your Navigations are played back. For this reason, Badboy automatically records Form Populators for you to set any changed fields on forms on the page. Note that Badboy will only record a Form Populator if one of the forms on the page has been changed from it's state when the page was first loaded.

Passive Navigations

Badboy supports two types of Navigation: Passive and Active.

  • Active Navigations are actions that cause (or are expected to cause) the browser to load a new page. By default, Badboy will wait for one of the open pages or frames to reload before continuing playing the script after a Passive Navigation is executed. Active Navigations are the most common kind and are typical for normal links in a web site.
  • Passive Navigations are a special kind of Navigation in that they do not expect a new page to load in the browser. These Navigations often perform no interaction with the server at all, although they may still change or activate parts of the browser window. A good example of a Passive Navigation is the frequent case where a user forgets to enter data into a form and a JavaScript check is done to remind them to enter it. The check might show a message box, or highlight the field on the page. However because it does not submit the form, no part of the page reloads from the server. Passive Navigations are especially important for web sites that use the so-called "AJAX" design methodology, since this kind of design often performs many background interactions that do not reload pages.

When Navigations are recorded, Badboy automatically notices whether there was a page load and sets the "Passive Navigation" option for you.

More Information

See the topic Recording Modes for more information about Navigations and how Badboy's recording of them works.

Badboy Documentation Generated on Mon Dec 29 22:28:42 EST 2008