Micro Focus QTP (UFT) Forums
Drop down value to be selected from excel_not yet resolved plz help - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: Drop down value to be selected from excel_not yet resolved plz help (/Thread-Drop-down-value-to-be-selected-from-excel-not-yet-resolved-plz-help)



Drop down value to be selected from excel_not yet resolved plz help - vijju7_test - 05-31-2012

Hi iam a fresher in automation field.

I have an web based application in which user gives his details in text boxes and dropdowns.
For automation i have supplied all the details in an excel which are:
Name,Location,State,Pin.
But the State field is a drop down field with some predefiend values.I store those state values in excel tab along with name,location,pin.

My requirement is qtp should select the state mentioned in the excels state field from the dropdown.
Im very much need of this........PPz help.

Thanks in advance.......Smile


RE: Drop down value to be selected from excel - sshukla12 - 05-31-2012

Hi,
Try this:
Code:
Window("Notepad").Dialog("Font").WinComboBox("&Size:").Select datatable(<columnname>,<sheetname>);


Hope this helps u.

Regards,
Sankalp


RE: Drop down value to be selected from excel - vijju7_test - 05-31-2012

Thnks sankalp but dis is not working......im getting an error message saying :cannot identify the specified item of the [state] object.confirm if the item is included in the objects item collection.


RE: Drop down value to be selected from excel_not yet resolved plz help - K Gaurav Varshney - 06-01-2012

Please share the code that you are using in selecting the values for 'State' field using the datatable values.

Regards,
K


RE: Drop down value to be selected from excel - ssvali - 06-01-2012

Hi, Try the below script

Code:
Set ObjExcel = CreateObject("Excel.Application")
ObjExcel.Visible = TRUE
Set sworkbook = ObjExcel.Workbooks.Open ("Z:\QTPForum.xlsx")
Set sworksheet = sworkbook.worksheets("Sheet1")
state = sworkbook.Worksheets("Sheet1").Cells(1,1).Value

All_Items = Browser(" ").Page(" ").WebList(" ").GetROProperty("all items")
Each_Item = Split(All_Items,";")
For i = Lbound(Each_Item) to Ubound(Each_Item)
    val = Each_Item(i)
    If val = state Then
        Browser(" ").Page(" ").WebList(" ").Select (state)
    End If
Next



RE: Drop down value to be selected from excel_not yet resolved plz help - vijju7_test - 06-01-2012

Hi all...........i imported the datatable value as below and it worked....!
Code:
x = Datatable("CUST_STATE",1)
Browser("").Page("").Frame("").WebList("").Select x
y = Datatable("STATE",1)
Browser("").Page("").Frame("").WebList("").Select y

Thanks for ur help....!