Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Selecting values from drop down using QTP.
#1
Solved: 10 Years, 8 Months, 3 Weeks ago
Hi There
I want to select all the values one by one and select one value from the drop down list.So How can I write the code for the particular?
As I have written the code as
Code:
Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").Select "somevalue1"
Which will select that particular value from the list but I want to check with all the values and select one from them.

Thanks
In Advance.
Reply
#2
Solved: 10 Years, 8 Months, 3 Weeks ago
Is this what you are looking at?

Code:
StrAllItems = Split(Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").GetRoProperty("All Items"),";")

For intCounter = Lbound(strAllItems) to Ubound(strAllItems)
   If Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").GetItem(intCounter) = "SomeValue" Then
            Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").Select (intCounter)
            Exit For
          Else
              msgbox "value not found...Please write a reporter event for this"
         End If      

Next

Or

Code:
iTemCount = Split(Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").GetRoProperty("Items Count")

For intCounter = 0 to iTemCount - 1
        If Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").GetItem(intCounter) = "SomeValue" Then
            Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").Select (intCounter)
            Exit For
          Else
              msgbox "value not found...Please write a reporter event for this"
         End If      

Next
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#3
Solved: 10 Years, 8 Months, 3 Weeks ago
Hello basanth27,
This Code is not working for me. It shows "The statement contains one or more invalid function arguments." in this line
Code:
Browser("...:=...").Page("..:=..").Frame("..:=..").WebList("..:=..").GetItem(intCounter) = "SomeValue"


So, please help ASAP.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to verify the drop down values based on condition santhoshmscsoftware 1 2,710 05-04-2016, 11:28 PM
Last Post: supputuri
  QTP not selecting appropriate webelement from the webtable..Need Solution satishkumarm 11 21,040 03-23-2016, 12:47 PM
Last Post: Swetha_Bayya
  Drag and drop issue excellentpawan123 0 2,595 01-13-2015, 05:04 PM
Last Post: excellentpawan123
  Drop down list class is a link thotamurali 2 3,962 08-22-2014, 05:48 PM
Last Post: thotamurali
Question How to do the QTP drag and drop between two different java objects? ioanaalm 4 7,712 05-23-2014, 03:34 PM
Last Post: excellentpawan123

Forum Jump:


Users browsing this thread: 1 Guest(s)