Search code examples
hp-uft

Need help selecting an item from a dropdown list in HP UFT


I need some help with selecting a value from a dropdown list. The dropdown is a WebElement, and the flow works well up to the point where the value should be selected.

My code is as follows:

.Browser("Browser").Page("PageName").WebElement("DropDownList").Click
.WebList("ListOfItems").Select(itemToSelect)

Note: itemToSelect is the name of the item that needs to be selected from the list, which is being passed as a parameter within the function.

When running the code, I get an unspecified error.

The weird thing is that before the error is thrown, I can see the value being selected from the list in the browser, as upon selecting it, some fields in the form change. Also, if I press "Skip" in the error message panel, the process goes on as if nothing happened.

I am certain the error comes from .WebList("ListOfItems").Select(itemToSelect) but I do not know what to do in order to fix it.


Solution

  • Thanks to everyone for your replies. The issue turned out to be due to the object not being added well to the repository. It was eventually fixed by adding it properly.