07-24-2009, 05:20 AM
[/u][/b]Hi,
I want to reduce the overhead of declaring objects such as write a 3-line decsription to declare WebEdit before I can use it. I am working on creating a dll in vb.net to do the declarations. Any user can simply refernce this dll in QTP and use the declarations present to simplify the qtp code. However, I cannot get this to work. Any idea on how to do this in vb.net. I created the following file but it is not working in QTP.
VB.net:[b]
I want to reduce the overhead of declaring objects such as write a 3-line decsription to declare WebEdit before I can use it. I am working on creating a dll in vb.net to do the declarations. Any user can simply refernce this dll in QTP and use the declarations present to simplify the qtp code. However, I cannot get this to work. Any idea on how to do this in vb.net. I created the following file but it is not working in QTP.
VB.net:[b]
Code:
Public Class Class1
Public Function QTPHelper_Example()
Dim qtApp As QuickTest.Application
Dim qtIdent As QuickTest.ObjectIdentification
Dim qtWebEdit As QuickTest.TestObjectClassIdentification
qtApp = CreateObject("QuickTest.Application")
qtIdent = qtApp.Options.ObjectIdentification
qtWebEdit = qtIdent.Item("WebEdit")
Return qtWebEdit
End Function
End Class
[u][/b]QTP:[b][/u]
Set objDLL=DotNetFactory.CreateInstance("ClassLibrary6.Class1","C:\windows\system32\ClassLibrary6.dll")
Set objwebedit=objDLL.QTPHelper_Example()
objwebedit("html id").value = "cnnHeadsrchText"
Browser(browser).page(page).WebEdit(objwebedit).Set "test"
Set objDLL= Nothing