I am having difficulties recording test scripts in jscript in certain areas of the application that I am trying to test. However, I find I do not have the same difficulties if I record in vbscript.
The example below covers some simple functionality as follows: The File->Open option is taken from the application menu, a ‘New Study’ button is selected on the resulting Open dialog box. Then a new ‘Create new study’ dialog box is displayed on which the study name is entered. Pressing Ok causes the study tree to be created.
The main issue seems to be that the jscript script is not able to distinguish between my two dialog boxes, whereas the vbscript script can. I have tried to alter the scripts, but the available structures when I am running in Jscript do not seem to cater for the second window. Can you give me some guidance as to what the issue may be here? I would really prefer to use jscript rather than vbscript for my scripting if at all possible.
In VBScript my recorded script is as follows
' Create new study from Open / New Study button
Set OCDSClient_OCDSStudyManager = Aliases.OCDSClient_OCDSStudyManager
Set frmMain = OCDSClient_OCDSStudyManager.frmMain
' Select File Open menu option
' Select New Study button from resulting Open Study dialog box
Actually, the object recognition and script recording functionality of TestComplete is the same for all scripting languages. So, the problem you are having is not related to the scripting language you are using. Feel free to use JScript if you like it.
The scripts you posted are almost identical in the sense of functionality, but there is one line in the JScript version of the test that indicates a problem:
Mapped names like "wndWindowsForms10Window8app0129c866" can be given to a window of a .NET application when the application is not recognized as Open by TestComplete for some reason. Taking into account that the problem is not persistent, I would assume this is a timing problem - the tested application sometimes gets busy for a long time and TestComplete cannot initialize its .NET Open Applications engine for this application. If my assumption is correct, increasing the value of the "Open Applications | General | Method invoke timeout" setting of your project should solve the problem.
So, delete the "wndWindowsForms10Window8app0129c866" object from the Name Mapping tree and record your test anew.