Micro Focus QTP (UFT) Forums
Unable to select value from Weblist using QTP - 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: UFT / QTP Others (https://www.learnqtp.com/forums/Forum-UFT-QTP-Others)
+--- Thread: Unable to select value from Weblist using QTP (/Thread-Unable-to-select-value-from-Weblist-using-QTP)



Unable to select value from Weblist using QTP - neenumaria - 08-07-2012

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


RE: Unable to select value from Weblist using QTP - sshukla12 - 08-07-2012

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


RE: Unable to select value from Weblist using QTP - neenumaria - 08-07-2012

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.


RE: Unable to select value from Weblist using QTP - Shridevi.Salagare - 08-07-2012

If select is not working ..
You can try Selectkey...
This used to work for me..

Let me know if this helps.


RE: Unable to select value from Weblist using QTP - NovGirl - 08-07-2018

Code:
Browser("browser").Page("page").WebList("list").select("val")
Browser("browser").Page("page").WebList("list").object.click

The above code worked for me.