Relevant Codes (by Anshoo Arora)

A Test Development Resource for HP QuickTest Professional.

QTP: Working with SiebPickLists

by Anshoo Arora on August 10, 2009

A SiebPickList object closely resembles a List object (WebList) in a Web based environment. A good reference for SiebPickList apart from the QTP help can be found here. Do not confuse a PickList with a SiebList object – they are very different in the way they work, and the latter is much more complex.

In our environment, there are many many SiebPickLists. A good majority of these PickLists are not required fields, but according to the requirements, random values must be selected; ie. the fields cannot be left blank. Since selecting random items in some PickLists does not impact the process, the following can be used to accomplish this task.

Selecting a random value in SiebPickList
The below function can be used to select a random value from the SiebPickList object:

'—————————————————————————————————————————
' Name: Function SiebPickListRandomSelect
' 
' Purpose: Randomly selects an item in a PickList object
' 
' Input:
'  oSiebApplet - object reference to the SiebApplet hierarchy
'  pValUINameSiebPickList - uiname property's value for the SiebList object
' 
' Output
'  Object
' 
' Date:
' 
' Author: Anshoo Arora
' 
' Remarks: 
'—————————————————————————————————————————
Sub SiebPickListRandomSelect( byRef oSiebApplet, pValUINameSiebPickList )
'—————————————————————————————————————————
    'A pick list in a Siebel test automation environment.

    Dim iCnt, i, vNextItemByIndex
 
    If InStr(1, pValUINameSiebPickList, "uiname") <> 0 Then
        pValUINameSiebPickList = Trim(Split(pValUINameSiebPickList, ":=")(1))
    End If
 
    With oSiebApplet.SiebPicklist("uiname:=" & pValUINameSiebPickList)
 
        ' Check if PickList is enabled
        If .IsEnabled Then
            ' Check if PickList is required
            If Not .IsRequired Then
                .Select "#" & RandomNumber.Value(0, .Count - 1)
            Else
                Reporter.ReportEvent micWarning, pValUINameSiebPickList, "Cannot" &_
                " Random Select. Field is Required."
            End If
        Else
            Reporter.ReportEvent micWarning, pValUINameSiebPickList, "Cannot" &_
            " Random Select. Field is disabled."
        End If
 
    End With
 
End Function

Getting all objects of a SiebPickList in a Collection
For required PickLists, I usually check if the item that is to be selected exists before making the selection. Following is how you can retrieve all the items of the PickList in a collection:

'—————————————————————————————————————————
' Name: Function SiebPickListGetAllItems
' 
' Purpose: Retrieve names of all items in a Collection from the PickList object
' 
' Input:
'  oSiebApplet - object reference to the SiebApplet hierarchy
'  pValUINameSiebPickList - uiname property's value for the SiebList object
' 
' Output
'  Collection 
' 
' Dependancy:
'  SiebPickListGetItemsCnt
' 
' Date:
' 
' Author: Anshoo Arora
' 
' Remarks: 
'—————————————————————————————————————————
Function SiebPickListGetAllItems( byRef oSiebApplet, pValUINameSiebPickList )
'—————————————————————————————————————————
    'A pick list in a Siebel test automation environment.

    Dim iCnt, i, vNextItemByIndex
 
    Dim oDict: Set oDict = CreateObject( "Scripting.Dictionary" )
 
    If InStr(1, pValUINameSiebPickList, "uiname") <> 0 Then
        pValUINameSiebPickList = Trim(Split(pValUINameSiebPickList, ":=")(1))
    End If
 
    iCnt = oSiebApplet.SiebPicklist("uiname:=" & pValUINameSiebPickList).Count
 
    For i = 0 to iCnt - 1
        vNextItemByIndex = oSiebApplet.SiebPicklist("uiname:=" & pValUINameSiebPickList).GetItemByIndex(i)
        oDict.Add i+1, vNextItemByIndex
    Next
 
    Set SiebPickListGetAllItems = oDict
 
End Function

The concepts in this article apply strictly to Siebel v7.7

If you have any questions, please ask them in the comments section. If your query is confidential, please use the Contact Form to send me an e-mail instead.

{ 3 comments… read them below or add one }

1 Robin October 21, 2010 at 7:18 am

Hi Anshoo,
I am faicng one issue in Siebel. I am working on Siebel Call Center. We use Descriptive Programming in automating Siebel. I have one SiebList in one of the view s and this contains different values. There is one Siebbutton and clicking on this button Popups new Applet and this applet contains another SiebList. My requirement is to select a value which should not be present in first SiebList. Can we store both the Sieblist values in an Array or do you have any better solution for the issue. Please reply ASAP.

Thanks in advance!
Robin

Reply

2 Anshoo Arora November 14, 2010 at 5:19 pm

Robin,

Using DP for SiebList is NOT recommended. You will encounter way too many issues that could be resolved by using Record/Playback. This is a very complex object and also because of CAS API, automation using run-time descriptions does not work well.

In your case though, since each SiebList is present in different views, you can reference different views and populate values as required through a loop + conditional statements..

3 Martin April 19, 2011 at 10:25 am

Anshoo,

Regarding SiebPicklist, we have a requirement to test that says when the Award Status (a SiebPicklist object) changes to a value of “LOI”, a browser side script pops up a Windows Internet Explorer dialog warning the user to enter Fees in the Fees field. If the user selects Cancel in the dialog popup, the Award Status reverts to its previous value; if the user selects OK, the Award Status is set to “LOI”.

The problem I am encountering is that the statement:

SiebApplication(“repositoryname:=Siebel Life Sciences for PACT”).SiebScreen(“repositoryname:=Opportunities Screen”).SiebView(“repositoryname:=” & sDetailView ).SiebApplet(“repositoryname:=” & sTopAppletName ).SiebPicklist(“repositoryname:=DCRI Award Status”).Select “LOI”

causes the Dialog popup to appear, but it “hangs” the test script because the Dialog popup prevents the Select statement from completing execution. I can process the Dialog popup just fine but cannot get to it due to the “hang”. There is no timeout error thrown and no way that I can see to process this with an Error handler. I am thinking that I need to process the Dialog popup with some kind of event handler. Do you have any suggestions on this Siebel browser side popup behavior.

Regards,

Martin

Reply

Leave a Comment

Previous post:

Next post: