3

I am trying to use QTP/UFT's DotNetFactory utility in standalone vbs files. I believe UFT is using DotNetFactory.dll found in the C:\Program Files (x86)\HP\Unified Functional Testing\bin to implement the feature. I have checked and found that the DLL is registered and its ComVisible property is also set to True. So effectively, I should be able to CreateObject to create an instance. However, VBScript (32-bit or 64-bit) is not able to create or get object for this dll.

enter image description here

None of the following is working

Set objDotNet = GetObject("C:\Program Files (x86)\HP\Unified Functional Testing\bin\DotNetFactory.dll")
Set objDotNet = GetObject(,"Mercury.DotNetFactory.1")
Set objDotNet = CreateObject("Mercury.QTP.Utils.DotNetFactory")
Set objDotNet = CreateObject("Mercury.DotNetFactory.1")
Pankaj Jaju
  • 5,371
  • 2
  • 25
  • 41
  • https://www.learnqtp.com/dotnetfactory-qtp-part1-basics/ suggests that you would use the command `DotNetFactory.CreateInstance("assembly.that.you.want.to.use")` in order to access the various assemblies for `.NET` – Dave Dec 19 '17 at 16:24
  • 1
    @Dave - I know how to use this in QTP. My question is related to standalone vbscript files. – Pankaj Jaju Dec 19 '17 at 16:41
  • Apologies, I took the question to be about using the functionality within `UFT`... – Dave Dec 19 '17 at 16:46
  • According to this answer from Motti, you can't... https://stackoverflow.com/questions/1986078/how-do-i-call-dotnetfactory-from-vbscript-in-a-stand-alone-vbs-file – Dave Dec 19 '17 at 16:48
  • I checked and found that UFT did expose the dll as com visible (used reflector to check) and it has prog-id (check image in question). The dll is registered as part of QTP installation. So in theory, we should be able to use it. – Pankaj Jaju Dec 19 '17 at 16:56
  • @PankajJaju Please do post a solution if you find one :) – Gurmanjot Singh Jan 02 '18 at 16:51
  • @Gurman - Sure. – Pankaj Jaju Jan 02 '18 at 17:09

0 Answers0