Problems with JScript referencing of application windows
<meta content="Word.Document" name="ProgId" />
<meta content="Microsoft Word 12" name="Generator" />
<meta content="Microsoft Word 12" name="Originator" />
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
Sub Test4
' Create new study from Open / New Study button
Dim
OCDSClient_OCDSStudyManager
Dim frmMain
Dim
frmCreateNewStudy
Dim
textEdit
Dim
groupControl
Set
OCDSClient_OCDSStudyManager = Aliases.OCDSClient_OCDSStudyManager
Set frmMain
= OCDSClient_OCDSStudyManager.frmMain
' Select File Open menu option
Call
frmMain.StripMainMenu.Click("File|Open")
' Select New Study button from resulting Open Study dialog
box
OCDSClient_OCDSStudyManager.frmOpenStudyOptionDialog.NewStudyButton.ClickButton
Set
frmCreateNewStudy = OCDSClient_OCDSStudyManager.frmCreateNewStudy
' In Create New Study dialog box enter new study name and
choose to create empty study. Then press OK
Set
textEdit = frmCreateNewStudy.StudyNameTextEdit
textEdit.wText =
"MK A New Empty Study 3"
Set
groupControl = frmCreateNewStudy.GroupControl1
groupControl.CreateEmptyStudyRadioButton.ClickButton
frmCreateNewStudy.OKButton.ClickButton
' Now click on Study tree to check that it has been
created
Call
frmMain.DockSite1.leftBar1.UCStudyExplorer.StudyExplorerPhysTreeView.ClickItem("|MK
A New Empty Study 3")
Call aqObject.CompareProperty(Aliases.OCDSClient_OCDSStudyManager.frmMain.DockSite1.leftBar1.UCStudyExplorer.StudyExplorerPhysTreeView.wSelection,
cmpEqual, "|MK A New Empty Study 2", False)
End Sub
In Jscript, the similar script comes out like this:
function
Test2()
{
var toolbarWindow32;
var OCDSClient_OCDSStudyManager;
var frmMain;
var frmOpenStudyOptionDialog;
var textEdit;
var textBoxMaskBox;
var groupControl;
OCDSClient_OCDSStudyManager
= Aliases.OCDSClient_OCDSStudyManager;
frmMain =
OCDSClient_OCDSStudyManager.frmMain;
// Select File-Open option from menu
frmMain.StripMainMenu.Click("File|Open");
// Select New Study button from resulting Open Study
dialog box
frmOpenStudyOptionDialog
= OCDSClient_OCDSStudyManager.wndWindowsForms10Window8app0129c866;
frmOpenStudyOptionDialog.NewStudyButton.ClickButton();
// In Create New Study dialog box enter new study name and
choose to create empty study. Then press OK
textEdit =
frmOpenStudyOptionDialog.StudyNameTextEdit;
textEdit.wText
= "MK MK Test Empty Study";
groupControl =
frmOpenStudyOptionDialog.GroupControl1;
groupControl.CreateEmptyStudyRadioButton.ClickButton();
frmOpenStudyOptionDialog.OKButton.ClickButton();
// Now click on Study tree to check that it has been
created
frmMain.DockSite1.leftBar1.UCStudyExplorer.StudyExplorerPhysTreeView.ClickItem("|MK
MK Test Empty Study");
aqObject.CompareProperty(Aliases.OCDSClient_OCDSStudyManager.frmMain.DockSite1.leftBar1.UCStudyExplorer.StudyExplorerPhysTreeView.wSelection,
cmpEqual, "|MK MK Test Empty Study", false);
}