QTP 9.0 and Adobe Reader----ActiveX objects (1418 Views)
Reply
Advisor
Asim Maqbool
Posts: 22
Registered: ‎02-29-2008
Message 1 of 17 (1,418 Views)

QTP 9.0 and Adobe Reader----ActiveX objects

[ Edited ]

Hi,

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

Browser("Browser").ActiveX("Adobe Acrobat 7.0 Browser").WinObject("AVPageView").Click 380, 433
Browser("Browser").ActiveX("Adobe Acrobat 7.0 Browser").WinObject("AVToolBarView").Click 24, 18
Browser("Browser").Dialog("Save a Copy").WinButton("Save").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.

Thanks
Asim

 

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

Honored Contributor
Henry Floyd
Posts: 1,033
Registered: ‎06-11-2008
Message 2 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

It is difficult to do anything in Acrobat activeX plug-in unless you have the full version of Adobe Pro Acrobat (it contains the VB controls that give you more access to the activex control).

I have never been successful without it. The only other way to do that I know of is to use mouse movements but that is not the most reliable method.
Advisor
Asim Maqbool
Posts: 22
Registered: ‎02-29-2008
Message 3 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

Thanks for your reply.

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.

Thanks
Asim
Honored Contributor
Henry Floyd
Posts: 1,033
Registered: ‎06-11-2008
Message 4 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

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.
Advisor
Asim Maqbool
Posts: 22
Registered: ‎02-29-2008
Message 5 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

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.

Thanks
Asim
Honored Contributor
Henry Floyd
Posts: 1,033
Registered: ‎06-11-2008
Message 6 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

I understand what you are trying to do.

And as far as recording the click on the save button on the pdf (which is the activeX control) the x,y is the best you will be able to do without the Acrobat Pro dlls.
Advisor
Asim Maqbool
Posts: 22
Registered: ‎02-29-2008
Message 7 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

Thank you Henry. I really appreciate your prompt response. Your answers helped me to understand it more effectively.
I will get back to you soon.

Thanks
Asim
Occasional Visitor
Rich K_1
Posts: 2
Registered: ‎07-29-2008
Message 8 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

There must be something special that has to be done with QTP. I have Adobe Pro and cannot identify the object buttons either.
Honored Contributor
Henry Floyd
Posts: 1,033
Registered: ‎06-11-2008
Message 9 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

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"


Option Explicit

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
Advisor
Asim Maqbool
Posts: 22
Registered: ‎02-29-2008
Message 10 of 17 (1,418 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

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..
Occasional Visitor
Rich K_1
Posts: 2
Registered: ‎07-29-2008
Message 11 of 17 (1,417 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

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?
Advisor
Asim Maqbool
Posts: 22
Registered: ‎02-29-2008
Message 12 of 17 (1,417 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

I have no idea for any plugin for qtp. I will have to search things around and will let you know if I come across anything...
Occasional Visitor
upraveen
Posts: 1
Registered: ‎08-28-2008
Message 13 of 17 (1,417 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

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.
Occasional Visitor
Riju
Posts: 1
Registered: ‎09-04-2008
Message 14 of 17 (1,417 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

Hey if you just need to click a button,try using the Send Key Option, first shift focus to required button (send Key - Tab) then click (Send Key - Enter).Let me know if u need code sample.
Advisor
Asim Maqbool
Posts: 22
Registered: ‎02-29-2008
Message 15 of 17 (1,417 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

I would appriciate if you can share sample code.

Thanks
Frequent Advisor
bjayepps
Posts: 53
Registered: ‎04-21-2009
Message 16 of 17 (1,417 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

you said it is in a different browser... if this is correct. have you tried just setting the opjecct to the other browser. and doing a Crtl-S?
Occasional Visitor
Aarsh
Posts: 1
Registered: ‎03-11-2014
Message 17 of 17 (956 Views)

Re: QTP 9.0 and Adobe Reader----ActiveX objects

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.

The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.