I am automating a web application which prints its report into PDF format in another browser. After printing the report into PDF I need to save it on a local drive.
When I recorded the steps which included printing and savig the report on loacl drive and played back,it gave me the error message.
My code has ..... Browser("Baseline").Page("docSearch").WebEdit("docNumber").Set "t18" Browser("Baseline").Page("docSearch").WebButton("Search").Click Browser("Baseline").Page("docView").WebButton("Print").Click
Can any one suggests me how can I deal with activeX objects in this particular case. During playback it goes upto printing the report into PDF in another browser then it fails to recognize the other browser and does not click the save button and gives this error
"Cannot identify the object "Adobe Acrobat 7.0 Browser" (of class ActiveX). Verify that this object's properties match an object currently displayed in your application."
I hope someone will reply on this.
P.S. This thread has been moved from Quality Center Support and News Forum to Unified Functional Testing (formerly QTP) News and Support Forum. -HP Forum Moderator
I may not be understanding it properly but can you correct me if I am wrong, what I understood is that currently we have Adobe Reader installed on our PCs and application prints the report using this Adobe Reader. Browser has ActiveX for this reader. You are saying that qtp is not good with adobe reader so we need to install Adobe Pro Acrobat and then browser would have its activeX which we can use in qtp.
The reader is fine. However with Acrobat Pro it includes the dlls that open up the libariers that allow you to interact with the activeX control in VBS. So unless you have PRO installed on every computer you are limited to what you can access in the activex control.
ok but I just need to save the pdf file and it requires to click the save button on ActiveX of Adobe reader. The only problem is when I record this it does give me the click event of activeX with some x, y coordinates. is it not possible that I can add save button as a web button object in my repository. I have to click on save button of adobe reader activeX. In case of dlls i will be doing this programatically at back end which is not the requirement. I hope you are getting my point.
What having pro does is expose the vb objects so instead of using Webobject(..).Click 1,2
You can use something like the following code taken from Dani Vainstein's "Scripting Quicktest Professional"
Dim AcroApp, AcroAVDoc Dim gPDFPath
gPDFPath = "C:\QTTutorial.pdf" ' ** Initialize Acrobat by creating App object Set AcroApp = CreateObject( "AcroExch.App" ) ' ** show Acrobat AcroApp.Show() ' ** Set AVDoc object Set AcroAVDoc = CreateObject( "AcroExch.AVDoc" ) ' ** open the PDF If AcroAVDoc.Open( gPDFPath, "" ) Then wait 1 acroApp.MenuItemExecute ( "ShowHideToolBar" ) MsgBox "toolbar should be hidden" acroApp.MenuItemExecute ( "ShowHideToolBar" ) wait 1 End If AcroApp.CloseAllDocs() AcroApp.Exit() Set AcroApp = Nothing : Set AcroAvDoc = Nothing
Thank you for your update. I dont have API for Adobe Reader which comes through Acrobat Pro. Anyways my only task was to click save button on PDF control panel in a browser. I tried to record and played back. Sometimes it fails to recognize the PDF controls. I dont have any answer for it yet..
Now I see the issue. The web element is a call to Adobe Reader, so even having Adobe Pro will not give access to the buttons. Having Adobe Pro will not overide this action. Without Adobe Reader there is nothing for the web page to call, so no Adobe buttons. Is there a plug-in for QTP that allows control of the Adobe buttons in the web element that calls Adobe Reader?
hi asim, pdf is a black box to automation tools, especially using the free acrobat reader. when working with adobe objects, it's not necessary to learn any adobe object into OR. learning the browser is sufficient (for sync, refresh or close). all other operations are done via adobe api's. dani's book is a very good starting point.
Browser("Browser").WinObject("AVPageView").Type micCtrlDwn + micShiftDwn + "s" + micShiftUp + micCtrlUp Window("Windows Internet Explorer").Dialog("Save a Copy").WinEdit("File name:").Set datatable("Path",dtglobalsheet) Window("Windows Internet Explorer").Dialog("Save a Copy").WinEdit("File name:").Type micTab Window("Windows Internet Explorer").Dialog("Save a Copy").WinComboBox("Save as type:").Type micTab Window("Windows Internet Explorer").Dialog("Save a Copy").WinButton("Save").Type micReturn Browser("Browser").CloseAllTabs
I have the similar issue so i resolved with the code above.This is working for most of the cases but when i get error and i have to click ok.than it fails. Thought this might solve your problem.I recorded all saved all the action via keyboard and used datatable to define path on Local machine.