Tips and Tricks
Read this before you attempt your first recording session

1. Wait for the page to completely load before clicking onto next step

Wait until the status bar at the bottom of the recorder says "Document Complete. Ready for User Interaction" before continuing. Your actions in the browser won't be recorded until this message is displayed.


2. Be deliberate

Be deliberate with all your actions. It will record actions even if they are not deliberate so to minimize user errors, make sure you know what you are doing before navigating.

3. Don't use browser shortcuts

Use the mouse to click on elements. Do not use "Enter" to submit forms or tabs to move to a different element. Also, don't use browser shortcuts to navigate around the page (e.g. Backspace to go to a previous page).

4. When working with select lists

When selecting an option from a select list, click away from it first then click the submit button. The select list relies on you to click away before it knows which value has been set.

If a select list uses an onchange event and causes the browser to go to another page when an element is selected in the select list, the script will have to be manually edited to work correctly. To see how this can be done, refer to the "How to..." section under the "Use select list" heading.

5. Display both secure and non-secure items

Some scripts may display a dialog box that says "Display both secure and non-secure items?" or something similar, when recording, if a button will trigger this dialog, click "Edit" in the menu at the top and click on "Custom Script Actions" and click "Add Accept Dialog Box" before the action that triggers the dialog occurs.

6. Wait times

Some pages will require custom wait times. These scripts require a user to wait until something shows up before proceeding. There is a menu item to add this wait. Click "Action" and click "Add wait_until". Fill in the values and click ok.

7. Popup Blocker

During playback, if the script is supposed to cause a new window to appear but it does not, it may be that the popup blocker in Internet Explorer is interfering with the script playback.

To disable the PopUp Blocker perform the following steps:
  1. Open Internet Explorer
  2. Click "Tools" in the Menu
  3. Click "Pop-Up Blocker"
  4. Click "Turn off Popup Blocker"

8. Auto Refreshing Web Pages (META Refresh)

Many sites use javascript to automatically refresh the user's browser while it processes the request in the background. Once the refresh is complete, script execution may continue because IE thinks the page has finished reloading.

To ensure that the page has completely loaded, it is sometimes necessary to add wait statements to wait for a specific object before continuing to execute the script.

Watir has a wait_until statement that is effective in handling these situations. To use the wait_until statement, we do the following:

wait_until(time_to_wait_in_seconds) { condition }

Example:
wait_until (60) { $IE0.contains_text('some text') }


In this example, we will wait for a maximum of 60 seconds for 'some text' to appear in browser $IE0 before continuing with script execution.