HI How to take screenshots of a Webpage and saving it in a
external word document using QTP.
Answers were Sorted based on User's Feedback
Answer / jegan
''Capture Currently display web page
Browser(objBrow).Page(objPag).CaptureBitmap "C:\Test.bmp",True
''Create word application
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objRang = objDoc.Range()
Set objShape = objDoc.inlineShapes
''Add Picture to word file
objShape.AddPicture ("C:\Test" & ".bmp ")
objWord.Selection.TypeParagraph()
''Save Word File
objDoc.saveas("C:\Test.doc")
Is This Answer Correct ? | 9 Yes | 1 No |
Answer / jkarurosu
I've tried the code and it works fine. I just have a question here, how can I add a second image at the end of the file. I've tried in different ways but the last image appears at the beginning of the file.
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / apurva
I am using the above code only.
''Create word application first
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
Set objRang = objDoc.Range()
Set objShape = objDoc.inlineShapes
"Capture Currently display web page
Browser(objBrow).Page(objPag).CaptureBitmap "C:\Test.bmp",True
''Add Picture to word file
objShape.AddPicture ("C:\Test" & ".bmp ")
"Capture Currently display web page
Browser(objBrow).Page(objPag).CaptureBitmap "C:\Test.bmp",True
''Save Word File
objDoc.saveas("C:\Test.doc")
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sumit
Try this Jkarurosu:Use Movedown method
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
'Set objRang = objDoc.Range()
Set objShape = objDoc.inlineShapes
''Add Picture to word file
fname="C:UsersPublicPicturesSample PicturesKoala.jpg"
fname2="C:UsersPublicPicturesSample PicturesTulips.jpg"
objShape.AddPicture (fname)
objWord.Selection.MoveDown 1,0
objWord.Selection.TypeParagraph()
objShape.AddPicture (fname2)
objWord.Selection.MoveDown 1,0
objWord.Selection.TypeParagraph()
''Save Word File
objDoc.saveas("C:UserssunshineDesktopTest.docx")
Is This Answer Correct ? | 0 Yes | 3 No |
how to lunch the application in the qtp tool ?
How to connect to the Database from QTP?
10 Answers DB, Thatavarti Technologies, Xchanging,
what is On Error Resume Next ?
How to get the format of a webedit class in qtp. How can i know that particular webedit accept what type of format like "mm/dd/yyyy" or "$" or Alphanumeric
draw the qtp frame work?
how can we handle exceptional handling in qtp
Is there anyway to have QTP go into a website and map out every object before I actually record any tests? I basically want to map out a website with all the objects and build a complete repository. The reason is because I'm running into issues with hierarcical objects. for example: Browser("ABC company- Home").Page("ABC company - Home").Link ("About Us").Click Browser("ABC company - Page 2").Page("ABC company - Page 2").Link("About Us").Click Both these links ("objects" and I use that term loosely as I'm trained mostly in OO programming) go to the same place but but the object heirarchies (pages) are different. I want a repository that will find any possible link on any possible page without having to manually record it. Is there a way to do this?
Explain the difference between check point and output value?
How to find duplicates in an array and remove them efficiently?
i did B.Tech cse and i secured 76%. instead of siting at home ... i would like to do some course. can u suggest me in this.
Please explain the role of Regular expression in QTP
Sql questions to find second max salary and how to use joins