Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unable to select value from Weblist using QTP
#1
Solved: 10 Years, 8 Months, 2 Weeks ago
Hi All,

I am trying to select a particular value from a weblist using QTP. The value is identified and highlighted, but it is not getting selected to the weblist

Code:
Source_Accnt="Access V"   'TEST DATA
Src_Accnt=Browser("browser").Page("page").WebList("list").GetROProperty("all items")
Src_list=split(Src_Accnt,";")
For i=0 to ubound(Src_list)
    Accnt_Source=Src_list(i)
    If instr( Accnt_Source,Source_Accnt) Then   'EXPECTED DATA IS "Access V...$57,689.65"
        Browser("browser").Page("page").WebList("list").Select Accnt_Source
                         Exit For
              End If
Next

The script is run without any error. In application the weblist still displays the defeault value "Please select". If we expand the weblist, "Access V...$57,689.65" value is highlighted in the list.

Could you please help me with the code so that the weblist displays the highlighted value?

Thank you
#2
Solved: 10 Years, 8 Months, 2 Weeks ago
Hi,
Use below code:

Code:
If [color=#FF4500]instr( Accnt_Source,Source_Accnt)>0 [/color]Then 'EXPECTED DATA IS "Access V...$57,689.65"
Browser("browser").Page("page").WebList("list").Select Accnt_Source
Exit For
End If
Next

Regards,
Sankalp
#3
Solved: 10 Years, 8 Months, 2 Weeks ago
Thanks Sankalp. Unfortunately that doesn't work for me. As i mentioned, the value is identified properly, but it is not getting selected. Now I just added a SUBMIT after selection and the value is getting selected Smile
Code:
Browser("browser").Page("page").WebList("list").Select Accnt_Source
Browser("browser").Page("page").WebList("list").Submit
It may not be the right way, but somehow its working now.
Thanks again for your reply.
#4
Solved: 10 Years, 8 Months, 2 Weeks ago
If select is not working ..
You can try Selectkey...
This used to work for me..

Let me know if this helps.
#5
Solved: 10 Years, 8 Months, 2 Weeks ago
Code:
Browser("browser").Page("page").WebList("list").select("val")
Browser("browser").Page("page").WebList("list").object.click

The above code worked for me.


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to match weblist data with expected values Anupama 5 2,524 05-18-2018, 12:15 PM
Last Post: Ankur
  WebElement (only Weblist) is not getting identified in QTP 11, Windows 7 priyaang 3 5,531 06-26-2015, 12:39 AM
Last Post: supputuri
  Application Issue on selecting value from weblist using UFT 12.1 on run sunilkgupta 0 2,175 01-01-2015, 08:22 PM
Last Post: sunilkgupta
  Unable to select items from WebLists CosmaShiva 8 6,563 07-23-2012, 06:23 PM
Last Post: Tarik Sheth

Forum Jump:


Users browsing this thread: 1 Guest(s)