Prompt Dialog For Password Entry In QTP with help of DotNetFactory
The following code popup a dialog with a edit box for a password entry when it run from the QTP
Set objForm = DotNetFactory.CreateInstance(“System.Windows.Forms.Form”, “System.Windows.Forms”)
Set objBtn1 = DotNetFactory.CreateInstance(“System.Windows.Forms.Button”, “System.Windows.Forms”)
Set objEdit1 = DotNetFactory.CreateInstance(“System.Windows.Forms.TextBox”, “System.Windows.Forms”)
x=80
y=40
Set p1 = DotNetFactory.CreateInstance(“System.Drawing.Point”,”System.Drawing”,x,y) ‘This will provide the locations(X,Y) for the controls
Set lbl= DotNetFactory.CreateInstance(“System.Windows.Forms.Label”,”System.Windows.Forms”)
lbl.Text=”Enter Password”
lbl.Location=p1
objForm.Controls.Add(lbl)
p1.Y=CInt(lbl.Height)+40
objEdit1.Location=p1
objForm.Controls.Add(lbl)
objEdit1.UseSystemPasswordChar=true’To set the password character From system
objForm.Controls.Add(objEdit1)
objBtn1.Text=”OK”
p1.Y=Cint(p1.Y)+CInt(objEdit1.Height)+20
objBtn1.Location=p1
objForm.CancelButton=objBtn1
objForm.Controls.Add(objBtn1)
objForm.StartPosition=CenterScreen
objForm.Text=”Mohan kakarla”
objForm.ShowDialog
msgbox “The Password You have Entered Is: “&objEdit1.Text
Author: Mohan Kumar Kakarla
9 Comments »
Leave a comment
-
Archives
- November 2008 (4)
- October 2008 (1)
- September 2008 (2)
- June 2008 (1)
- March 2008 (4)
- February 2008 (44)
-
Categories
- Automated Test Script Creation Process
- Automating MS Word
- Automating QC
- Automation Object Model For QTP
- Backward compatability in QTP
- Browser Scripts
- COM and QTP
- compare 2 text files
- Descriptive programming
- Descriptive Programming and Child Objetcs
- Dictonary Object
- DotNetFactory
- Excel Automation
- Extra Topics
- Files and Folders
- General Standards to be followed in Test scripts
- New Features In QTP9.5
- QC-OTA
- QTP Additional Faqs
- QTP Faqs
- QTP Naming Convention
- QTP Tips and Faqs
- Running stored procedures from QTP
- Send keyboard keys
- Uncategorized
- Uninstall a software using QTP
- Uninstall a software using vbscript
- Update data in a database
- VBScript and IE Automation
- VBScript Faqs and Useful resources
- What’s New in Quick Test Pro 9.0
- Whats New in QTP 9.5
- XML Scripting
-
RSS
Entries RSS
Comments RSS

hai
Plz any one can give QTP Full tutorial on 9.5
Thanks and Regards
Prasad
Prasad,
If you have the 9.5 installed , you can find very good help file there only. else download evaluation verson and find the help file
Hello,
My requirement is to create a Form with multiple edit boxes and radio buttons using QTP 9.5. Where can i get a full list of all the objects and their properties, that i can create using DotNetFactory.
Thanks and Regards,
Siva
So far there is no good material on DotNetFactory. what u can do id goto msdn http://msdn.microsoft.com/en-us/library/system.windows.forms.aspx
and look for the required object(edit box ,radio etc) read the example and understand how it works , then use ur dotnetfactory knowledge to write code.
Mohan Kumar kakarla
Hello Mohan,
Thank you for the reply. I have checked the link provided by you and will try to use the same.
Thanks and Regards,
Siva
Hi,
Its good to see u r posts.But i do have a an idea calling a function,so that write instructions to dynamically attach object repository and perform necessary operations and de-attach the object repository and end the function.
Is there any procedure to implement this idea.
Hi,
I need to design QTP framework in my organization
Kindly Help me. What factors should taken care about for that.
thank in advance
Nirmal
Nirmal Kumar,
1. find the Reusability factor and design the components
2. create shraed OR
3. Test data
4. Flow of the TC
5. Driver script,recovery scenarios etc
Hi,
I wrote the similar code as above to get the user id / password and save it to excel sheet.
But my problem is after executing the code, the pop up dialog is not displayed on the top of all screens but instead it is behind all the windows.
can you tell me what command it have to use to bring it to front?
THanks