Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
WScript object in QTP...
#1
Solved: 11 Years, 4 Months, 3 Weeks ago
Hello,

Could you help, please, to call WScript in QTP

I have a code:
Code:
Set objNetwork = WScript.CreateObject("WScript.Network")

But QTP doesn't accept it and says "Object required:"

Thanks in advance!!!
Reply
#2
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi please don't use WScript.CreateObject("WScript.Network")
Instead give
Code:
Set objNetwork = CreateObject("WScript.Network")
Reply
#3
Solved: 11 Years, 4 Months, 3 Weeks ago
Hi,
Yes, it works! Thank you!
Reply
#4
Solved: 11 Years, 4 Months, 3 Weeks ago
Here is the answer why u r getting the error:
It represents the state of a WSH process(When you click on your vbs file the WSH process starts).The whole point of the WScript object is that it represents everything about the presently running Windows Script Host

The WScript object exposes various properties about the running script and the WSH environment. Now If we run a QTP test, its run in some QTP host but not WSH.

So how can we expect the Wscript Object to be used without a WSH process Actually running.
Reply
#5
Solved: 11 Years, 4 Months, 3 Weeks ago
This article explains why you got the error
http://knowledgeinbox.com/articles/vbscr...roduction/
Reply
#6
Solved: 11 Years, 4 Months, 3 Weeks ago
Thanks to all for the detailed explanations... and the link :-)
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  variable is undefined: wscript shipu 1 4,533 01-09-2014, 07:23 AM
Last Post: basanth27
Exclamation Problems with "WScript.Shell" [QTP 10.0] Mukesh.Laxmidhar 0 4,002 01-17-2011, 02:11 PM
Last Post: Mukesh.Laxmidhar

Forum Jump:


Users browsing this thread: 2 Guest(s)