Import method will imports the specified Excel file to the run time datatable.
Ex: Datatable.Import ("C:\sample.xls")
ImportSheet method will imports a specified sheet of a specified file to a specified sheet in the datatable.
Ex: Datatable.ImportSheet "c:\sample.xls", SourceSheetName(or Number), DestinationSheetName(or Number)
If excel file has 7 sheets, if we use import method, then all the 7 Sheets are imported into the runtime datatabe?
The Answer is No. Only the first 2 sheets will be imported into the runtime datatable.
Not all the sheets.
why because, By default datatable will have 2 sheets (Global/Local)
If you add an action in the QTP then only, a new sheet will be added in to the datatable.
Important Topics & Useful Scripts on QTP. Ask your QTP related questions at this id - asrajaputra@gmail.com
Saturday, June 7, 2008
How to compare the list box items with another
Here i am giving the script to compare the list box items with another -
To run this script you have to add all the objects into the object repository
(Find the link in this blog "how to add objects into the object repository")
Window("Flight Reservation").activate
SeltItem = window("Flight Reservation").winComboBox("Fly From:").GerROProperty("text")
msgbox SelItem
'It displays the selected item in the list
ListItem = Window("Flight Reservation").WinComboBox("Fly To:").GetContent
msgbox ListItem
'It displays all the items in the list box
Itemcount = window("Flight Reservation").WinComboBox("Fly To:").GerItemsCount
msgbox Itemcount
'It displays no of items in the list box
For i=0 to Itemcount-1
a=window("Flight Reservation").wincombobox("Flt To:").GetItem(i)
If SelItem=a Then
msgbox "Items Are Matching"
else
msgbox "Items Are Not Matching"
End If
Next
To run this script you have to add all the objects into the object repository
(Find the link in this blog "how to add objects into the object repository")
Window("Flight Reservation").activate
SeltItem = window("Flight Reservation").winComboBox("Fly From:").GerROProperty("text")
msgbox SelItem
'It displays the selected item in the list
ListItem = Window("Flight Reservation").WinComboBox("Fly To:").GetContent
msgbox ListItem
'It displays all the items in the list box
Itemcount = window("Flight Reservation").WinComboBox("Fly To:").GerItemsCount
msgbox Itemcount
'It displays no of items in the list box
For i=0 to Itemcount-1
a=window("Flight Reservation").wincombobox("Flt To:").GetItem(i)
If SelItem=a Then
msgbox "Items Are Matching"
else
msgbox "Items Are Not Matching"
End If
Next
Script for Orkut Login
url = "www.orkut.com"
Systemutil.Run "IExplore", url
'It will open a Browser with any website address
Browser("name:=orkut - login").WebEdit("name:=Email").set "rajaputra"
Browser("name:=orkut - login").WebEdit("name:= Passwd").setSecure "47525d8be4926ea2f6e96b9a3f7472b6ae38"
Browser("name:=orkut - login").WebButton("name:=Sigh in").Click
Browser("name:=orkut - login").Link("name:=Logout").Click
Browser("name:=orkut - login").Close
Systemutil.Run "IExplore", url
'It will open a Browser with any website address
Browser("name:=orkut - login").WebEdit("name:=Email").set "rajaputra"
Browser("name:=orkut - login").WebEdit("name:= Passwd").setSecure "47525d8be4926ea2f6e96b9a3f7472b6ae38"
Browser("name:=orkut - login").WebButton("name:=Sigh in").Click
Browser("name:=orkut - login").Link("name:=Logout").Click
Browser("name:=orkut - login").Close
Subscribe to:
Posts (Atom)
About Me
- RAJAPUTRA
- Hi all,I am Arun Singh Rajaputra. I am working as a Project Lead in a reputed organization in Hyderabad, AP, India. I have little bit knowledge on Quick Test Professional and like to share my knowledge to all through this blog.
Subscribe to get updates on this blog
NOTE
Some of the posts posted in this blog are collected and most of them have been prepared by me. If any one have objections regarding any copied posts. Please mail me so that I can take a necessary action on that post.