Web object not working during recording yet on replay its works fine

When QuickTest Professional is recording against web-based applications using a great deal of JavaScript within, there are scenarios where some objects aren’t working, however once same page/screen gets refreshed when QTP isn’t recording or when Web Add-in isn’t loaded, the object works fine (for example a link not redirecting page to new location when recording, yet during replay it does work fine)

The hook(s) on either one or multiple events used by problematic web object is/are conflicting. This is normally caused because of the web-based application JavaScript related objects getting created or finish loaded in parallel when QTP loads the Web support to the page/screen/application, therefore if the support loading process finishes before an object isn’t fully loaded (for example events getting loaded last), hooks will be included, yet possibly causing for actual functionality of the event being overwritten, that is the “Click” event on a link or WebElement being analyzed, however its functionality getting broken (clicking not doing anything) due to conflicts.

Determining which particular event is encountering problems will provide inside either for a fix or reconfiguration of QTP to allow proceeding with automation.

To analyze which events are causing the problem:

· Access the Web Event Recording Configuration dialog (go to “Tools” and select “Web Event Recording Configuration” option

· Click on “Custom Settings…” button to show “Custom Web Event Recording Configuration” dialog. Note: On the left side, a tree view control shows different types of web test objects and on right side are shown all events being listened/recorded

· Before moving forward, backup/export to a file the current settings, by going to “File” and selecting “Save Configuration As”. Note: exported file can be “imported” by going to “File” and selecting “Load Configuration”

· Expand “Web Objects” (under “Any Web Object” item on left side) and find/highlight/select test object showing problematic behavior

· Once selected a test object, delete all the events displayed on right side of dialog (select event on list, then go to “Event” menu and select “delete)

· Click “Ok” on currently opened dialogs to confirm changes and go to back to main screen of QTP

· Confirm undesirable functionality against problematic test object isn’t happening no more. Note: it is expected to not record (scripts getting generated or objects getting added to repository)

· Now add back each deleted event (with same settings as before on “Listen” and “Record” columns, testing problem after adding each event back

· Note: Once determined which particular event (or multiple events) is reproducing issue, try following options if applicable

The following are workarounds to deal with scenarios where situation presents:

A. If "onclick" event is causing problem, replace it for “onmousedown” plus “onmouseup” events:

· Delete the "onclick" event from under both item called "Any Web Object" and from item related to problematic test object (for example "Link") on the Web Recording Configuration dialog

· Add/Insert both the events "onmousedown" and "onmouseup" events under modified items of step #1 with settings for "Listen" and "Record" the values "Always" and "Enabled" respectively

· Go to QTP Tools menu, select "Options" and access the "Advanced" section for "Web" tab/option

· Enable "Record settings > Record MouseDown and MouseUp as Click" option

· Click "Apply" then "Ok" to go back to main screen

· Click "New" to create a new blank test (or go to File > New > Test) or load desired test script (if already opened, close and reopen so new settings get applied to test)

· Test new settings

B. In case is not "onclick" event the one causing conflict:

· Start recording against problematic scenario

· Once problem happens, stop recording

· Refresh page/screen and confirm problematic object is now working. Note: it may be necessary reload entire browser to get support be loaded appropriately if refreshing the page/screen isn’t possible or such presents problems/restrictions

· (Optional) On QTP Script, click the location where new recorded script lines will be inserted/appended.

· Start recording once object is working correctly

Note: Repeat steps against each time during recording an object "looses" it’s functionality

IMPORTANT: In case script’s replay is also affected by this situation, then after the SYNC method usage on Browser test object, include another line using the REFRESHWEBSUPPORT method. For example:

‘…

Browser("MyApplicationWithLotsOfJavaScript").Sync

Browser("MyApplicationWithLotsOfJavaScript").RefreshWebSupport

‘…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s