Objectives
The objectives of this article are :
- Learn how to use DOS command lines in QTP.
- Alternative complex tasks.
- Alternative .NET methods.
Posted in QTP Techniques
The objectives of this article are :
Posted in QTP Techniques
You must be logged in to post a comment.
April 16th, 2008 at 7:29 am
Thanks for such a good article.
Here i want to add few more points
1. wShell.Exec is useful only when two command are mutually independent of each other. Say Dir , md, cd etc these commands we can automate.
2. But if you are trying to automated some CLI utility like ftp or telnet,i guess wShell.Exec will not solve our purpose.
I will really appreciate any valuable suggestion on how to automate ftp, Telnet or any other CLI utility .
Thanks,
Manish Bhatla
April 16th, 2008 at 8:01 am
Hi manish
you right. it doesn’t work with cli, telnet, http://FTP.
the first method ( Type, GetVisibleText ) do work with telnet and cli, but is limited
for FTP we already have a solution, read the article FTP your scripts.
http://www.advancedqtp.com/knowledge-base/articles/files-id15/ftp-your-scripts/
April 17th, 2008 at 6:59 am
Thanks Daniva for your suggestion.
I already saw that article its very good.
I was looking for some generic solution for all CLI utility.
Thanks,
Manish Bhatla
April 17th, 2008 at 2:47 pm
Thanks for this gud article but i have following doubt
Alternate of GetText(0) and GetVisibleText functions on 64bit windows OS?
I want to read the output from command prompt window, don’t want to redirect to a file
On 32-bit OS I am using GetText utility which is working fine but for 64-bit OS like X64 or IA64 QTP function GetText is not working at all and GetVisbileText is not working properly
So I am looking for some alternate for this (GET THE TEXT FROM COMMAND PROMPT WINDOW AT RUN TIME ON 64-BIT OS?)
April 20th, 2008 at 7:00 am
Hi,
When I copy the statement from the article above and paste it in QTP Expert view, it throws errro : “Invlid Character”
eg : Line from your code:
Print Window( “object class:=ConsoleWindowClass” ).GetROProperty( “title” )
Then I have to delete all quotes from your statement and reinsert from keywboard. Please looki into it. and workaround it so that we can directly copy paste and use ur code.
Thanks
April 20th, 2008 at 10:11 am
It’s is a very informative material posted, i was wondering where could u get the whole set of information about advanced QTP….. Daily I get to know a lot when i go through this site…. Thanks a lot
May 2nd, 2008 at 6:54 pm
hi rajkamalinnit
yes…is a known problem when copying from articles.
those special quotes are symbols ( “Smart quotes” called by Microsoft.
until today i didn’t find a way to fix it…
so you have to fix it manually…sorry
May 4th, 2008 at 5:21 pm
Dani, rajkamalinnit - The issue has been resolved. All “smart quotes” are now automatically transformed to regular quotes when the page is displayed.
May 4th, 2008 at 6:17 pm
[…] to rajkamalinnit who alerted us to the issue, we’ve activated a workaround which intercepts the articles before they are […]
May 5th, 2008 at 9:17 am
Thanks for the excellent Code
May 7th, 2008 at 8:54 am
Very gud articles here
May 15th, 2008 at 8:02 pm
This Article was really helpful.
I was trying to work with wshell.run command for creating and copying File structures. But facing an QTP error while executing the commnads. Kindly Help
Please find the code below
1. wshell.Run “MKDIR C:\Test”
- Using this Command to create a Folder called Test in my C drive.
2. wshell.Run “XCOPY C:\Douments and Settings\SVeeram\Desktop\Sample.xls C:\Test\ /E/Y/F”
- Using this Command to Copy a excel file from my desktop to the folder created.
May 21st, 2008 at 12:25 am
Hi Suresh
i think that you are missing the quotes on the path name
Try this
cmd = “XCOPY ” & Chr(34) & ” C:\Douments and Settings\SVeeram\Desktop\Sample.xls” & Chr(34) & ” ” & Chr(34) & “C:\Test\” & Chr(34) & ” /E/Y/F”
Or
cmd = “XCOPY ‘C:\Douments and Settings\SVeeram\Desktop\Sample.xls’ ‘C:\Test\’ /E/Y/F”
May 22nd, 2008 at 6:41 am
Very useful info
June 19th, 2008 at 12:05 pm
Thanks a lot to creater of this site.
Really helpful.
July 9th, 2008 at 7:01 am
Thanks very much…
Vicent
July 18th, 2008 at 10:39 am
Great article, I am ablel to learn another way to manipulate CMD object.
July 29th, 2008 at 10:32 pm
Great article. However, I’d like to be able to launch a Telnet session using the .Exec object in order to access the stdOut object.
Set objExec = objShell.Exec(”%comspec% /K telnet beesting”)
It basically just doesn’t launch a Telnet session.
Ultimately, what I am after is all the text that is displayed during a session, without using .GetVisible text.
I have tried the following so far:
1)
objShell.Run “Telnet -f ” & telnetLogPath & ” ” & telnetServer
The “-f” flag will write a text log file to a local drive. The downside to this is it doesn’t write a line until some form of Enter or Carriage Return is entered.
2)
Directly through the windows API. I have not had any luck doing any “screen scraping” with this method either.
Any thoughts?
Regards,
Ed
September 2nd, 2008 at 11:23 am
Thanks a lot Buddies.. Really Nice one
September 5th, 2008 at 11:08 am
thanks a lot for all the value documents.Really nice one.
September 9th, 2008 at 9:36 am
Thanks for posting this article very good one to learn
October 10th, 2008 at 4:15 pm
Very good post
October 15th, 2008 at 7:08 pm
Thank you so much for posting this script. This is very useful.
December 12th, 2008 at 7:47 am
GetVisibleText is not working in Windows 2008. It is working fine in Windows 2003.
So is there any solution for Windows 2008?
December 25th, 2008 at 4:47 am
Just what I was looking for, thanks guys
January 27th, 2009 at 11:49 am
Hi … I am using wShell.Exec to run the telnet command. Once the prompt comes up i need to input the user name and password in the window opened… can some help on if there is any menthos that i can use with the wShell object to input the commands please.
February 20th, 2009 at 1:51 pm
It really explains and helps………..
March 6th, 2009 at 11:28 am
its a very good article
http://hpsquicktestprofessional.blogspot.com/
April 7th, 2009 at 11:38 am
superb document and great work
April 21st, 2009 at 10:26 am
Thanks a lot buddy.
This article is very much helpful to me……
June 2nd, 2009 at 8:48 am
it’s very nice article.
August 25th, 2009 at 8:34 am
Very good Article.