in our asp.Net web app. i've used this wText Property to check in a dropdownlist(as Select("name") object by TestComplete) whether the right item was selected. But "sometime" it returns empty, although in object property Panel its Property wText value <> "" . I've checked on Runtime by debugging, the value ist empty. The validate function looks like this:
Set ddlist = ...Select("object Dropdownlist")
Sub ValidateDDList(ddlist, "textItem") ' Select("object Dropdownlist") exists
If ddlist.wText = "textItem" Then
Call Log.Message("DDList testing - " + ddlist.wText + " selected successfully")
Call Log.Error("DDList testing -" + ddlist.wText + "selected unsuccessfully")
And it runs always the else branch. How can i work around with this issue?
Question: Are the contents of your DropDownList populated from a data source or are they a "hard coded" list of choices for the end user? If they are populated from the data source, it could be that the scripts are running "too fast" and that, occasionally, they are hitting the wText property on your list before it is populated.
I'd suggest using the WaitProperty method on your DropDownList to wait a period of time to allow for that list to populate. I wouldn't actually use the wText property for this but, I believe, many dropdown/combo box components have a property that indicates how many items are in that list. If you make it so that you wait until that count is greater than a specified number, this might resolve your problem.