Ask a Question

How to open any file from desktop in keyword test

SOLVED
Kanwar
Occasional Contributor

How to open any file from desktop in keyword test

Hi, I want to open a PDF file from desktop using keyword test operation. For this which operation can I use? I tried aqFile.OpenTextFile and it ran without an error but file didn't open.

@TanyaYatskovska @Marsha_R 

 

thanks

 

9 REPLIES 9
Marsha_R
Community Hero

There are some requirements here for working with PDF files.  There are also some keyword test examples.  See if this helps.

 

https://support.smartbear.com/testcomplete/docs/testing-with/working-with-external-data-sources/pdf....


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
Kanwar
Occasional Contributor

@Marsha_R  Thanks for your response. Unfortunately, my testcomplete version 14.20 does not have Intelligence Quality add-on enabled and that's stopping me to validate PDF files. Do we have any other alternatives or we must need to enable this add-on which will cost us extra bucks?

 

Thanks

bach_ls
Occasional Contributor

If i'm not mistaken the only method available to you is importing external java library, but a) its usage is restricted to scripts and b) it's a bit complicated. You can find great tutorial online: https://support.smartbear.com/articles/testcomplete/testing-pdf-files-with-testcomplete/. But beware: library referred in this tutorial treats pdfs as txt files, so it is easy to work with text, but no so much when more complicated stuff is involved (fonts, pictures, page layout).

I don't believe you can achieve something like that in keyword tests without paying for add-on.

Can you get a text version of the document and save it in the same place as the pdf?  That way you can still make sure that the storage area is accessible to TC and you can compare a text file rather than a pdf.  It's not exactly the same test, but I'm guessing that you are more interested in the content of the document rather than the fact that it's stored as a pdf.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
Kanwar
Occasional Contributor

@bach_ls  thanks for your reply but I was more interested in Keyword Test, I know we can achieve this by script.

Kanwar
Occasional Contributor

@Marsha_R  Thanks I will follow this method for PDF comparison.

Sorry I took the discussion to other point. I was looking for Keyword operations to open PDF file from the desktop. The link you gave me in your first post doesn't give much information about that. There must be some operations available in Keyword Test to open PDF file. 

anupamchampati
Frequent Contributor

Hello Kanwar

 

You can try File verification

https://support.smartbear.com/testcomplete/docs/testing-with/checkpoints/files/comparing-by-bytes.ht...

 

I did the same for PDF and it worked perfectly fine

Stored the Master PDF in the Stores > Files 

and than compare the file with Baseline it will do comparing by bytes.

Code : Files.Items(FileName).Check(SavePDFPath);

There aren't always Keyword Test options for everything.  That's why you can use Run Code Snippet or Run Script Routine inside a keyword test to extend the functionality.


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
sonya_m
SmartBear Alumni (Retired)

Thank you for helping, Community! Great job here!

 

Hi @Kanwar ! Have you tried the recent suggestions in this thread? Do they help?


Sonya Mihaljova
Community and Education Specialist

cancel
Showing results for 
Search instead for 
Did you mean: