background image
<< Capturing the Properties of Java Applets | Recording Mouse Movements >>
<< Capturing the Properties of Java Applets | Recording Mouse Movements >>
Synchronizing Pages
Testing HTML Applications
13-16
Synchronizing Pages
Whenever you click on a page for the first time, Robot inserts a
Browser
NewPage
command into the script. This command causes Robot to wait for the contents of the
page to fully load before continuing, and also helps prevent timing problems that
could cause scripts to fail when they are played back. The following scenarios
illustrate how this works.
For more information about page synchronization, see the description of the
Browser
command in the SQABasic Language Reference.
Capturing Properties or Data of Window Objects
Any time you plan to capture the data or properties of a window object, be sure to
click in the window before inserting an Object Data or Object Properties verification
point. Clicking in the window inserts a
Browser
NewPage
command into the
script and ensures proper synchronization between pages.
Using the Browser's Back and Forward Buttons
If you use the Back or Forward buttons to navigate to a previously viewed page while
recording a script, you must perform some action on the page before you click the
Back or Forward button again. Clicking on the page, for example, inserts the
Browser NewPage
command into the script, and just as with the previous
example, ensures proper synchronization between pages.
Recording Transactions
When you submit a purchase order for an e-commerce transaction, there may be a
substantial delay before the Web server responds with a confirmation. In fact, a Web
server may send one or more interim pages while it is processing the transaction.
Robot waits 30 seconds, by default, for this confirmation to arrive from the server. If
the confirmation requires additional time, you will see the warning New Page Not
Found
in the log after you play back the script. To correct this problem, edit the script
by adding a Wait value greater than 30 seconds to the
Browser NewPage
command, as in the following example:
Browser NewPage, "HTMLTitle=Thank you for your order!", "Wait=45"
In this example, the use of HTMLTitle in the recognition string allows Robot to
identify the correct page at playback and skip over any interim pages. The Wait value
causes Robot to wait 45 seconds for this specific page to be displayed.