Thread Rating:
  • 2 Vote(s) - 3 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How To Find Dropdown Object based on Values from the dropdown list
#11
Solved: 11 Years, 3 Months, 3 Weeks ago
(05-18-2012, 06:29 PM)mesg2anil Wrote: Hi,

I'm having difficulty scripting for below situation...

I have a dropdown list, in the dropdown list I've values as below...
one
two
three
four
five

I want to find the dropdown object exists or not based on the dropdown list values as shown above. How to find the object? Please help!!

Regards,
Anil

Hi you can use the Excel,You can matching the value with application drop down value to Excel input value:

Function DropDownValidation(Str_ExcelPath)
    
Str_ExcelPath= "C:\Users\chvijay\Desktop\SDB_Dropdwon list_5.0.xlsx"
Set objExcel = CreateObject("Excel.Application")
Set objWorkbook = objExcel.WorkBooks.Open(Str_ExcelPath)
Set objDriverSheet = objWorkbook.Worksheets("witholding-tax-code")
count_rows=objDriverSheet.usedrange.rows.count
 DropDownItems=Browser("INTEGRATION").Page(INTEGRATION").WebList("frm:tabView:integratedLocalAcc_5").GetROProperty("all items")
 Str_Result=split(DropDownItems,";")

For i = 0 To UBound(Str_Result) Step 1
    finelresult=Str_Result(i)
    finelresult1=finelresult1&" "&finelresult
    Next
    print "Item In Drob Down"&"-"&finelresult1
        For j= 2 To count_rows Step 1
        read_Value_Excel= objDriverSheet.cells(j,1).value
         print "ReadValue From Excel"&" "&read_Value_Excel

        If ucase(trim(instr(finelresult1,read_Value_Excel)>0))Then
            objDriverSheet.cells(j,5)="Available"
            DropDownValidation=true
         else

            objDriverSheet.cells(j,5)="Not Available"
            'MsgBox "Not Write"
           DropDownValidation=False
        End If
    Next
    
    objWorkbook.Save
    wait 2
    objExcel.Quit
Reply
#12
Solved: 11 Years, 3 Months, 3 Weeks ago
I would use Instr method to find out if the list item present in the list or not.

Code:
DropDownItems=Browser("INTEGRATION").Page(INTEGRATION").WebList("frm:tabView:integratedLocalAcc_5").GetROProperty("all items")
DropDownItems = ";" & DropDownItems

'Now use instr to check if the searching list item is there in the list
ListItemToValidate = "Four"

If Instr(DropDownItems,";" & ListItemToValidate & ";")>0 Then
  Msgbox "here goes your pass result"
Else
  Msgbox "here goes your fail result"
End If
Let me know if you have any questions.
Thanks,
SUpputuri
Reply
#13
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

I have similar issue in selecting a value from the web list. I have only 2 values in which 1st value is a default and I need to select  second value.

Example source code:

<SELECT id=D_Message.SETLCYCLE_NB class=field style="WIDTH: 60px; POSITION: absolute; LEFT: 120px; TOP: 92px" name=D_Message.SETLCYCLE_NB>
<OPTION id=DefaultValue selected value=1>1</OPTION>
<OPTION id=DefaultValue value=2>2</OPTION>
</select>

My Script:


allitems=Browser("..").Page("..").Frame("..").WebList("..").GetROProperty("all items")
    
    For i = 1 To allitems-1        

             Browser("..").Page("..").Frame("..").WebList("..").Select "2"
Next
        
But still I am not able to select second value from the weblist. Please let me know if I am missing any steps.

Regards,
Sandy
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  how to select value from google search box dropdown +QTP prajyot 0 2,901 06-28-2017, 06:30 PM
Last Post: prajyot
  Trying to create List box in excel sheet at Run time with values yes No JACKSPARROW 0 1,713 01-17-2017, 11:05 AM
Last Post: JACKSPARROW
  General Object Error(Find Object Error) akhandesh 1 3,604 02-24-2016, 01:05 PM
Last Post: sindhus
  Compare second web list value according to the first web list value roselin6 1 2,846 10-07-2015, 09:14 PM
Last Post: supputuri
  Problem selecting in a dropdown menu during playback. qemls29 9 13,039 07-28-2015, 05:44 PM
Last Post: Sharan

Forum Jump:


Users browsing this thread: 1 Guest(s)