Micro Focus QTP (UFT) Forums
Selecting a state from a weblist - 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: Selecting a state from a weblist (/Thread-Selecting-a-state-from-a-weblist)



Selecting a state from a weblist - sunny rao - 01-08-2009

Hi Guys,

I came across some simple but unusual problem. Please reply if you have any suggestions.

1) I am selecting a state from weblist object

Code:
Browser("abc").Page("xyz").Weblist("state").Select Datatable("Global","State")

So I am able to select NewYork, Texas, Florida by passing through the Datasheet but not able to select Massachusetts.(1) I checked that Massachusetts is present in the drop down of the object.(2)Checked the spelling and the Case of text. As of now I am using If statement to bypass it. Write if you have any suggestions for this prob.


RE: Selecting a state from a weblist - Akpene - 01-08-2009

You may want to check if an Datatable entry has extra space at end of text. The Weblist selection does a character to character comparison on text so a space would matter. Hope this helps.


RE: Selecting a state from a weblist - sreekanth chilam - 01-09-2009

Hi ,

U try in two ways :

1st way :
Give trim functions for value retrieved from datatable as given below.(This will eliminates any trailing or leading blank spaces & return the string alone)

Code:
Browser("abc").Page("xyz").Weblist("state").Select trim(Datatable("Global","State"))

2nd Way:
Just perform Recording for the selection of "Massachusetts" value from Weblist.
script will be generated as :
Code:
Browser("abc").Page("xyz").Weblist("state").Select "Massachusetts"

Just Copy the Massachusetts Value & paste into the datatable sheet & Save the script.

Now try to re-execute. I hope it will be able to select the required value from datatable.


RE: Selecting a state from a weblist - sunny rao - 01-15-2009

Thanks guys it was the empty blank space in the Datatable cell that was causing this problem it is solved now