Trouble using Description.create() methods with Weblist objects

Given an existing code block that used Description.Create to access web APP objects, that worked with a drop-down menu of WebElements to select one for a .Click , I modified the code block to use the WebList objects that were in the next web APP under test. It didn't work.

The new version is of the form:
Set objSite = Descripttion.Create
   objSite("micclass").Value = "WebList"
   objSite("class").Value = "site"
   objSite("innerhtml").Value = ".*US-.*"
Set Siteobj = Browser("B").Page("P").Frame("F").ChildObjects

The above block of code resulted in 37 WebList items being selected. (Good!)

The debug "show me" block below worked fine, but did display a little crazy:
Browser("B").Page("P").Frame("F").WebList("site").Click 'open the drop-down menu
For i = 0 To Siteobj.count - 1 Step 1
    Siteobj(i).highlight
   Result = Siteobj(i).GetROProperty("innertext")
Next

Using the line from the old WebElement code block that worked, I tried to us it for WebList dropdown menu:
Siteobj(4).Click 
It did not work.

Does anyone know how to make a selection from a WebList object?
Thanks in advance (TIA)

  • Ooops!
    Descripttion.Create 
    should have been
    Description.Create

  • A colleague showed me a more direct way to access and select from a drop-down menu of Class WebList:
    Browser("B").Page("P").Frame("F").WebList("site").Select("<SiteName>")
    where <SiteName> is one of the named items inside the WebList.

    So, I have a solution for the test, but I sure would like to know how to make the Description.Create method (that I originally posted) work.

  • Hi,

    When you said:
        WebList dropdown menu:
        Siteobj(4).Click 
        It did not work.
    Only for that object (no.# 4) ??

    Was it the last object on the drop down list? Can you provide a screenshot of that web list open with it's items exposed?
    I had some trouble selecting items from a web drop-down, I ended up selecting it using the ARROW keys and evaluating each value, until the expected one is found...

     

  • > "Only for that object (no.# 4) ??"

    Siteobj.count is 37
    The following debug method stepped through them, making them blink in the web browser.

    For i = 0 To Siteobj.count - 1 Step 1
        Siteobj(i).highlight
       Result = Siteobj(i).GetROProperty("innertext")
    Next

    "Siteobj(4).Click"  did not work.
    "Siteobj(5).Click" did not work.
    et cetera. No attempt to use that script line on any of the 37 items in Siteobj worked.

    > "Was it the last object on the drop down list?"
    No, Siteobj(36) was the last object in the list.

    > "Can you provide a screenshot of that web list open with it's items exposed?"
    No, that is not possible. The tests are done on a network that has no connectivity to the Internet. I lack a channel to move a screen-shot to this Internet connected computer.

    > "I had some trouble selecting items from a web drop-down, I ended up selecting it using the ARROW keys and evaluating each value, until the expected one is found."
    Thank you for the suggestion, but I must use scripts so that automated Regression Tests can be made without human involvement. Is there a UFT scripted method to use the arrow keys after selecting the WebList object?

  • Try using the webpackage setting step before you click on the option. This will pass control to mouse rather than using event, that sometimes helps. 

    Setting.WebPackage("ReplayType") = 2

    "Siteobj(4).Click"

    Setting.WebPackage("ReplayType") = 1

    GoScriptLESS 

  • Hi again.

    This reply is for your last question regarding the item selection thru arrow keys. I did this because, I too, had problems selecting the item explcitly thru UFT's context sensitive commands...

    Public Function DeviceReplay_Selection (myObj, SelVal)
        
        Setting.WebPackage("ReplayType") = 2
        QTApp.Options.Run.StepExecutionDelay = 0
        QTApp.Options.Run.RunMode = "Fast"
        
        ' to start the keystrokes, it is necessary first to "initialize" the object by click.
        myObj.Object.Focus
        wait 0500
        myObj.Click    ' this should OPEN the list
        wait 0500
        myObj.Click    ' this should CLOSE the list
        wait 0500

        retval = myObj.GetROProperty("innertext")
        ' check the current value
        print ("DeviceReplay_Selection -> First value is  : " & retval)
        
        If (SelVal = retval) Then
            DeviceReplay_Selection = 0
            Exit Function
        End If
                

        ' loop through the values of the drop down
        Set myDeviceReplay = CreateObject("Mercury.DeviceReplay")
        keystroke = ""
        val_found = False
        
        Do While (val_found = False)
        
            retval = ""
            retval = myObj.GetROProperty("innertext")
            ''print "DeviceReplay_Selection -> " & retval
            
            If (IsNumeric(retval) = False) Then
                myDeviceReplay.PressKey 208    ' KeyDown
                wait 0500
                myDeviceReplay.PressKey 208    ' KeyDown
                wait 0500
                retval = myObj.GetROProperty("innertext")
            End If
            
            If (SelVal = retval) Then
                val_found = True
                Exit Do
            End If 
        
            If (SelVal > retval) Then
                keystroke = 208 ' KeyDown
            Else
                keystroke = 200 ' KeyUp
            End If
            myDeviceReplay.PressKey keystroke 
            
        Loop
        
        set myDeviceReplay = nothing
        QTApp.Options.Run.RunMode = "Normal"
        Setting.WebPackage("ReplayType") = 1
            
    End Function

     

    example : 
    rc =  DeviceReplay_Selection(YourAccount.WebElement("WebElem_DayBirth"), "08")

    Please give your thgouhts...

  • Wow! That was some post.

    It will take me a while to digest it, and see what it can do for me w.r.t. my original scripting difficulty.

    Thank you for your help.