简体   繁体   中英

Automate a selection of multiple values from a multi-select list box UFT web app

I am having a case where in a web based application I have to automate a selection of multiple values from a multi-select list box and then keep them as a result. I am struggling how to do that. I am getting error message "object required"->

Dim list, arrayRepIDs, i

list = Browser("").Page("").WebList("").GetROProperty("all items")

arrayRepIDs=split(list,",")

For i=0 to UBound(arrayRepIDs)

    If(arrayRepIDs.Selected)= true Then
    Msgbox "You selected..."
    End if

Next

I assume you're getting the error on the If line (in the future try to give as much information in the question as possible). The arrayRepIds is an array of strings but you're accessing its (non-existent) .Selected property. You also seem to think you're iterating through the array but you're not using the index i , rather you're doing the same thing on each iteration.

Instead of using GetROProperty("all items") you should be using GetROProperty("selection") .

See which properties are available here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM