In the Part 1 of this blog we looked at how the IE plugin of UITest framework records and playsback actions. In this blog we will look at known issues with this plugin and how to troubleshoot failures

 

Known Issues with Record and Playback in IE

1) IE tabs – If recording is done with tabs and it is played back on a machine without tabs or the Tabs are not in the same order, playback will fail.

2) If a random dialog/popup comes up when a page is navigating which did not come up during recording, play back will fail

3) If a control that playback is trying to act on is blocked by another control, playback would fail. User needs to un cover the control and do a retry

4) The following controls are not supported

a) A edit box that has rich edit box functionalities like making characters bold or changing the font etc.,

b) Mark and select a text inside a text box is not supported

c) A tree node control which was in expanded condition during recording and it is in the collapsed state during playback

d) Performing non-standard actions like right click etc on file upload dialogs does not result in setvalue aggregation on the file upload box. This action could fail during playback when performed in a different machine.

e) If the menu is in expanded state during recording and if it is collapsed state during playback

5) Web applications rendering non-standard HTML page is not supported

6) Clicking on Back and forward button while the IE page is still navigating. Playback will fail or it may take the user to a wrong page.

7) Actions on IE in windows server where Enhanced Security configuration (ESC) is enabled. To disable ESC, you need to make the following registry setting.

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap" /v "IEHarden" /t REG_DWORD /d 0 /f

8) Drag / Dragdrop actions where the drag window content property is set to false. To Ensure that this property is set to true, you need to make the following registry setting

reg add "HKCU\Control Panel\Desktop" /v DragFullWindows /t REG_SZ /f /d 1

 

List of IE Settings for better resilience while doing playback in IE

By default there are a few IE default settings which might interfere with the playback. For example, once the playback does a setvalue on a password box, IE sometimes throws a dialog to remember the password. The playback engine does not have any mechanism to workaround these dialog prompts. We strictly playback the actions recorded. For playback to be resilient we might need to suppress a few prompts/dialogs in IE before we do playback or run a Coded UI Test on IE.

Listing the commands to suppress unnecessary dialogs to make playback more resilient

IE Setting

Batch Script Command

Turning off the Prompt that asks whether to turn on the AutoComplete

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\IntelliForms" /v "AskUser" /t REG_DWORD /d 0 /f

Turning IE Auto Complete off

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "Use FormSuggest" /t REG_SZ /d "no" /f

Turning off Information Bar

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\InformationBar" /v "FirstTime" /t REG_DWORD /d 0 /f

Turning autocomplete password off

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "FormSuggest PW Ask" /d "no" /f

Disabling the Stop running script dialog

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles" /f

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Styles" /v "MaxScriptStatements" /t REG_DWORD /d 0 /f

Disabling prompt for downloading activex controls

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1" /v 1001 /t REG_DWORD /d 0x0 /f

Turning off prompt dialog box to post data

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\1" /v 1601 /t REG_DWORD /d 0x0 /f

Disabling automatic crash recovery in IE8

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main" /v "IE8RunOnceLastShown_TIMESTAMP" /t REG_BINARY /d 7a2f3f462098c901 /f

Turning on Automatic Logon using current username and password for Win2k8

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\3" /v 1A00 /t REG_DWORD /d 0x0 /f

Turning off automatic website checking

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PhishingFilter" /v Enabled /t REG_DWORD /d 0x0 /f

 

Troubleshooting failures

Tool for debugging search issues

Most of the exceptions thrown also contains the primary properties of the control on which the playback is being done. We can make use of these properties to search for the control and make sure if it is in an actionable state.

IE Developer Toolbar:

The Internet Explorer Developer Toolbar provides several features for exploring and understanding Web pages. The tool lets you to explore the document object model (DOM) of a Web page. It lets you to locate and select specific elements on a Web page through a variety of techniques.

This tool can be downloaded at

http://www.microsoft.com/downloads/details.aspx?familyid=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en

In IE8, this toolbar is packaged along with the product. Press ‘F12’ in IE8 to invoke this toolbar.

Exceptions & what they mean

Playback on IE can fail due to various reasons and the playback engine throws the best exception out of a variety of playback exceptions for the user to rootcause the reason for the failure.

Recording Time Failures

Possible Exception

Cause

Comment

TechnologyNotSupportedException

Recoding on a unsupported technology App

If the user tries to record on applications on IE whose version is below 7 or on 64-bit IE, the recorder throws a technology supported exception.

Playback time failures

Playback does two major things in order to perform action on the control search and action on the control. Following are the possible reasons and their exceptions.

SearchFailure

Following are some of the suggested tips to debug the search failure during playback.

  • See screenshot (stored in %temp%\uitestlogs\lastrun if logs are enabled) to see whether the control was actually visible or not.
  • Verify the search properties and UI hierarchy (QueryID) using IE Developer Toolbar.

Possible Exception

Cause

Comment

UITestControlNotFoundException

The control does not exist or search properties are not enough to find the control.

User can use IE Developer Toolbar and see whether the search properties and the hierarchy are correct

UITestControlNotAvailableException

The control does not exist in the app now.

Whenever the playback performs an action on a control, it is cached for future references. When the playback tries to act on this cached control which is no longer available, the playback throws this exception.

Action Failure

Sometime though the search passes but the playback may not be able to do the action on the control. Following may be the possible reason/tips to debug the issue

· Verify using IE Developer Toolbar whether, is there any other control with the same properties under the parent mentioned in the QueryID. Some time there may be more than one control with the same properties under a parent hence during playback the first control will be selected and the action may fail on it. User can work around it after adding the instance property in the code for the ambiguous control.

· User can use .DrawHighLight() method to actually see which control is chosen for the UITestAction. This method is available for all the UITestControl and will draw a rectangular highlighter around the control.

· Verify whether the control state is same as it was during recording e.g., SetValue was recorded on a text box but during playback the text box is read only.

Possible Exception

Cause

Comment/Possible workarounds

ActionNotSupportedOnDisabledControlException

Playback is trying to perform action on a disabled control

This is thrown when the playback try to do some action on the disabled control/read only controls. Following are some of the cases:

· SetValue on a read only combobox/text box

· Click/SetState on disabled buttons/checkboxes

FailedToPerformActionOnHiddenControlException

When the playback tries to act on a control which is present but is not visible

The control cannot be visible when we set the CSS styles of the control to be hidden. The user has to make the control visible before the playback can perform any action on it.

FailedToPerformActionOnBlockedControlException

The control exists but not actionable

Thrown when a control is blocked in this case though the search passes but the required action will not be played back. Following might be some of the causes for this exception

· The control is not visible in the view port and not scrollable even

· Control is blocked due to some modal dialog on top of it

DecodingFailedException

May come in password text box

When the decoding of encrypted password fails due to incorrect key value.

PlaybackFailureException

Default fall back exception for uncategorized issues

For any other failure the playback engine would throw PlaybackFailureException. For example if Get/Set of some property fails for a control playback engine would throw PlaybackFailureException.

Summary

In this blog we have seen the known issues with IE plugin and how to troubleshoot failures with IE developer toolbar.

 

Author – Praveen R

SDET - CodedUITest