Micro Focus QTP (UFT) Forums

Full Version: Selecting a state from a weblist
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.
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.
Thanks guys it was the empty blank space in the Datatable cell that was causing this problem it is solved now