12-09-2009, 07:06 PM
hi all ,
i am automating a web application . The web application has a test case to download different version of a file by clicking on download button.
following is the record using QTP
------------------------------Cut from original code----------------------
---------------------------- End of Cut---------------------------------
this cod is for downloading a file called ""15_pkgId129170115_2.5.4"" as you can see from code
now the problem is :if the file name changes from 15_pkgId129170115_2.5.4 to some "xyz" QTP displayed an error "The "0% of XYZ." Dialog object was not found in the Object Repository. which is quite genuine.
now i want to script it in such a way that even if file name changes to xyz it should work without any error.
I tried with following but failed:
---------------------------try 1------------------------------------
--------------------------try1 end----------------------------------
--------------------------try2---------------------------------------
-------------------------0try2 end----------------------------------
i am automating a web application . The web application has a test case to download different version of a file by clicking on download button.
following is the record using QTP
------------------------------Cut from original code----------------------
Code:
Dialog("0% of 15_pkgId129170115_2.5.4.").Dialog("File Download").WinButton("Save").Click
Dialog("0% of 15_pkgId129170115_2.5.4.").Dialog("Save As").WinEdit("File name:").Set "c:\n40\data\test.jar"
Dialog("0% of 15_pkgId129170115_2.5.4.").Dialog("Save As").WinButton("Save").Click
Dialog("0% of 15_pkgId129170115_2.5.4.").WinButton("Close").Click
this cod is for downloading a file called ""15_pkgId129170115_2.5.4"" as you can see from code
now the problem is :if the file name changes from 15_pkgId129170115_2.5.4 to some "xyz" QTP displayed an error "The "0% of XYZ." Dialog object was not found in the Object Repository. which is quite genuine.
now i want to script it in such a way that even if file name changes to xyz it should work without any error.
I tried with following but failed:
---------------------------try 1------------------------------------
Code:
Dialog(*).Dialog("File Download").WinButton("Save").Click
Dialog(*).Dialog("Save As").WinEdit("File name:").Set "c:\n40\data\test.jar"
Dialog(*).Dialog("Save As").WinButton("Save").Click
Dialog(*).WinButton("Close").Click
--------------------------try2---------------------------------------
Code:
Dialog("File Download").WinButton("Save").Click
Dialog("Save As").WinEdit("File name:").Set "c:\n40\data\test.jar"
Dialog("Save As").WinButton("Save").Click
Dialog("*").WinButton("Close").Click