Set objGmail =description.Create
objGmail("html tag").Value ="A"
'objGmail("Class Name").Value="Link"
Set objMail=Browser("Gmail: Email from Google").Page("Gmail: Email from Google").ChildObjects(objGmail)
objCB=objMail.count
msgbox objCB
Tuesday, July 26, 2011
Call User defined Function in QTP
for Technical interviews:
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
Public Function Login (Agent,Password)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set (Agent)
Dialog("Login").WinEdit("Password:").Set (Password)
Dialog("Login").WinButton("OK").Click
End Function
Develope this function in Notepad and save with ext. .vbs. after that Setting->Resources-> Add this finction.
and call into the test..
Login "Skhan", "Mercury"
Thanks,
Shahadat Khan
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
Public Function Login (Agent,Password)
SystemUtil.Run "C:\Program Files\HP\QuickTest Professional\samples\flight\app\flight4a.exe","","C:\Program Files\HP\QuickTest Professional\samples\flight\app\","open"
Dialog("Login").WinEdit("Agent Name:").Set (Agent)
Dialog("Login").WinEdit("Password:").Set (Password)
Dialog("Login").WinButton("OK").Click
End Function
Develope this function in Notepad and save with ext. .vbs. after that Setting->Resources-> Add this finction.
and call into the test..
Login "Skhan", "Mercury"
Thanks,
Shahadat Khan
Function in QTP
Login "Skhan","Mercury"
Public Function Login (Agent,Password)
Dialog("Login").WinEdit("Agent Name:").Set (Agent)
Dialog("Login").WinEdit("Password:").Set (Password)
Dialog("Login").WinButton("OK").Click
End Function
Public Function Login (Agent,Password)
Dialog("Login").WinEdit("Agent Name:").Set (Agent)
Dialog("Login").WinEdit("Password:").Set (Password)
Dialog("Login").WinButton("OK").Click
End Function
Thursday, July 21, 2011
How to swap two numbers without using third variable?
a = inputbox ("Enter the first value")
b = inputbox ("entre the second value")
msgbox "before swapping a="&a
msgbox "before swapping b="&b
a = int(a)+int(b)
b = int(a)-int(b)
a = int(a)-int(b)
msgbox "After swapping a="&a
msgbox "After swapping b="&b
for Technical interviews:
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
b = inputbox ("entre the second value")
msgbox "before swapping a="&a
msgbox "before swapping b="&b
a = int(a)+int(b)
b = int(a)-int(b)
a = int(a)-int(b)
msgbox "After swapping a="&a
msgbox "After swapping b="&b
for Technical interviews:
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
How to check wheather the string contains particular word or not in the string in qtp
for Technical interviews:
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
Var = "I am Shahadat Khan working with qtp"
If instr(1,Var,"Shahadat")then
msgbox "exist"
else msgbox "Not exists"
end If
Thanks,
Shahadat Khan
http://no1tutorial.com/
learn step by step technologies:
http://no1tutorial.com/
Var = "I am Shahadat Khan working with qtp"
If instr(1,Var,"Shahadat")then
msgbox "exist"
else msgbox "Not exists"
end If
Thanks,
Shahadat Khan
How to containts from Data table ?
Environment("Reportpath")="C:\Result.xls"
a=Browser("Google").Page("Google").WebTable
("index:=0").GetROProperty("outerhtml")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WriteFile = FSO.CreateTextFile( Environment
("Reportpath"), True)
writeFile.writeLine(a)
writeFile.close
a=Browser("Google").Page("Google").WebTable
("index:=0").GetROProperty("outerhtml")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WriteFile = FSO.CreateTextFile( Environment
("Reportpath"), True)
writeFile.writeLine(a)
writeFile.close
Wednesday, July 20, 2011
How to Past an Image into the word documents?
Set objWord = CreateObject( "Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents. Add()
Set objSelection = objWord.Selection
Set objShape = objDoc.Shapes
objShape.AddPicture ("c:\images.jpg")
objWord.Visible = True
Set objDoc = objWord.Documents. Add()
Set objSelection = objWord.Selection
Set objShape = objDoc.Shapes
objShape.AddPicture ("c:\images.jpg")
Wednesday, July 13, 2011
How to read contents from a file and write into the another file in QTP?
Dim, fso, file1, file 2, x
Set fso = Createobject("scripting.filesystemobject")
set file1 = fso.opentextfile("C:\Skhan\sk1.txt")
set file2 = fso.createtextfile("c:\skhan\sk2.txt")
Do Until fso.AtEndOfstream = True
x = file1.readline
file2 = writeline.x
Loop
File1.close
File2.close
Set fso.Nothing
Thanks,
Shahadat Khan
Set fso = Createobject("scripting.filesystemobject")
set file1 = fso.opentextfile("C:\Skhan\sk1.txt")
set file2 = fso.createtextfile("c:\skhan\sk2.txt")
Do Until fso.AtEndOfstream = True
x = file1.readline
file2 = writeline.x
Loop
File1.close
File2.close
Set fso.Nothing
Thanks,
Shahadat Khan
File System Objects(FSO) Model:
The File System Object (FSO) model provides an object-based tool for working with folders and files. It allows us to use the familiar object. method syntax with a rich set of properties, methods, and events to process folders and files. We can also employ the traditional Visual Basic statements and commands.
The FSO model gives our application the ability to create, alter, move, and delete folders, or to determine if and where particular folders exist. It also enables us to get information about folders, such as their names and the date they were created or last modified.
The FSO model makes processing files much easier as well. When processing files, our primary goal is to store data in an efficient, easy-to-access format. We need to be able to create files, insert and change the data, and output (read) the data. Although we can store data in a database, doing so adds a significant amount of overhead to our application. We may not want to have such overhead, or our data access requirements may not call for the extra functionality associated with a full-featured database. In this case, storing our data in a text file or binary file is the most efficient solution.
The FSO model, contained in the Scripting type library (Scrrun.dll), supports the creation and manipulation of text files through the TextStream object; however, the FSO model does not support binary files. To manipulate binary files, use the FileOpen Function with the Binary keyword.
FileSystemObject
Main object. Contains methods and properties that allow you to create, delete, gain information about, and generally manipulate drives, folders, and files. Many of the methods associated with this object duplicate those in other FSO objects; they are provided for convenience.
Drive Object
This Object Contains methods and properties that allow you to gather information about a drive attached to the system, such as its share name and how much room is available. Note that a "drive" isn't necessarily a hard disk, but can be a CD-ROM drive, a RAM disk, and so forth. A drive doesn't need to be physically attached to the system; it can be also be logically connected through a network.
Folder Object
This Object contains methods and properties that allow you to create, delete, or move folders. Also allows you to query the system for folder names, paths, and various other properties.
TextStream Object
This Object allows you to read and write text files.
The FSO model gives our application the ability to create, alter, move, and delete folders, or to determine if and where particular folders exist. It also enables us to get information about folders, such as their names and the date they were created or last modified.
The FSO model makes processing files much easier as well. When processing files, our primary goal is to store data in an efficient, easy-to-access format. We need to be able to create files, insert and change the data, and output (read) the data. Although we can store data in a database, doing so adds a significant amount of overhead to our application. We may not want to have such overhead, or our data access requirements may not call for the extra functionality associated with a full-featured database. In this case, storing our data in a text file or binary file is the most efficient solution.
The FSO model, contained in the Scripting type library (Scrrun.dll), supports the creation and manipulation of text files through the TextStream object; however, the FSO model does not support binary files. To manipulate binary files, use the FileOpen Function with the Binary keyword.
FileSystemObject
Main object. Contains methods and properties that allow you to create, delete, gain information about, and generally manipulate drives, folders, and files. Many of the methods associated with this object duplicate those in other FSO objects; they are provided for convenience.
Drive Object
This Object Contains methods and properties that allow you to gather information about a drive attached to the system, such as its share name and how much room is available. Note that a "drive" isn't necessarily a hard disk, but can be a CD-ROM drive, a RAM disk, and so forth. A drive doesn't need to be physically attached to the system; it can be also be logically connected through a network.
Folder Object
This Object contains methods and properties that allow you to create, delete, or move folders. Also allows you to query the system for folder names, paths, and various other properties.
TextStream Object
This Object allows you to read and write text files.
Subscribe to:
Posts (Atom)