Skip to content

Replies

0
Michael Germann
Michael Germann answered on May 26, 2011 5:05 PM

It's been a while, but in looking again the Cell should have a ValueListResolved property that should be viable to use if the ValueList is set on either the Cell or the Column, again it may be necessary to drop down the cell before doing this via PerformAction that I mentioned earlier.

SET grid = SwfWindow("Form1").SwfTable("ultraGrid1")
iRow = 2
sCol = "VL_Column"
sValListItems = "Rows[" + CSTR(iRow) + "].Cells[" + sCol + "].ValueListResolved.ValueListItems"

iVLItemsCnt =  grid.GetNAProperty(sValListItems + ".Count")
sListValues = ""

For x = 0 to iVLItemsCnt – 1
    sListValues = sListValues + grid.GetNAProperty(sValListItems + "["+cstr(x)+"]") +vbCRLF
Next
msgbox sListValues

0
Michael Germann
Michael Germann answered on May 24, 2011 4:56 PM

  That depends highly on how, where and when the combobox's gets it's data as well as what the combobox actually is. By default, I would say you should be able to use GetNAProperty to get either the cell's or the columns ValueList property, and look at it's ValueListItems. But it is also quite possible that the combobox is a customized editor that doesn't follow that methodology or place of storage for it's data, or that it only populates the combobox on dropdown, and the valuelists are empty prior to that. For the later you can activate the cell, then PerformAction gridEnterEditModeAndDropdown, then try to get the value of the valuelists. If none of those work, I would suggest contacting your developer and learning more about this particular instance of combobox itself.

As to QTP getting ahold of the specific combobox, in most scenarios the combobox is an editor component and not really a control. In which case QTP has no knowledge of it, as it only interacts with objects that inherit form System.Windows.Forms.Control.

 

0
Michael Germann
Michael Germann answered on May 16, 2011 9:02 PM

Hi,

Can you paste the exact line of code that is giving you the error message "IG : Member [Tools] not valid."? The reason I ask is "Tools" is definitely a valid property on the ToolbarsManager, so I believe something else is going on here.

0
Michael Germann
Michael Germann answered on May 13, 2011 8:09 PM

Hi,

   Key not found in the MergedTools collection means that it is not a merged tool, so that rules that logic out. As to the Tools[strToolKey].Value not working. Since it didn't give you a Key not found exception, means it did find the tool. Just that the tool in question doesn't have a value property. The question is why? Are you looping through all of the tools, and since some Tools don't inherently have a Value property the error is thrown? If you are only interacting with only one Tool, that tool then isn't one of the following:
    ComboBoxTool
    FontListTool
    MaskedEditTool

   So the question is what is the tool type, and from that we can determine what properties are appropriate. If your are working with TestAdvantage 10.3 or later, you should also have access to GetNAProperties, which will give you a list of all available properties during runtime on the instance of the object that you are looking at. So you can do something like the statement below and it will list all the available properties and their return types.

msgbox SwfWindow("").SwfToolbar("").GetNAProperties("Tools["+strToolName+]")

 

I hope this helps,

 

0
Michael Germann
Michael Germann answered on May 11, 2011 4:22 PM

Correct QuickTest Professional(QTP) only really interacts with objects that derive from System.Windows.Forms.Control. The tools internal to the Infragistics UltraToolbarsManager are not controls, they are just abstract objects that may resemble controls. The UltraToolbarsManager itself is not a tool either, but a component, but is typically housed on a custom dockarea or a custom popup window, and that is the control we generally interact with as far as QTP is concerned.

   That being said, you should be able to generally still get the current property values via the base Tools collection. Such as :

msgbox SwfWindow("").SwfToolbar("").GetNAProperty("Tools["+strToolKey+"].Value")

This should work primarily because all tools regardless of where they are located are just instances of the root tool in the Tools collection. All values, if there the tool has a value, are thereby shared with all instances of the root tool.

If it cannot find it there, it could possibly be an MDIMerged tool, ie a tool that existed on a parent window, that was merged down the the ToolbarsManager on a child window, and you are trying to interact with it on the Child window. In that case you would need to access it slightly differently:

msgbox SwfWindow("").SwfToolbar("").GetNAProperty("MergedTools["+strToolKey+"].UnderlyingTool.Value")

I hope this offers you a valid solution,

0
Michael Germann
Michael Germann answered on Apr 21, 2011 5:24 PM

Hi Nooruddin,

     At this point I can poke blindly at a few hypothetical solutions, but as mentioned before I believe we will need a sample that reproduces this behavior, to truly understand what's going on and how to resolve it. The only other scenario I can see that would do as you describe is a little far fetched, being that the control's upper left hand corner is being recognized as the point it is scrolling up to, which in that case, there would be no "permanent fix" for that scenario. Turning off the AutoScrollIntoView, and manually scrolling the portion of the control that you need to interact with would be the resolution. Does this happen with every control that needs to be scrolled into view or just this solitary UltraComboEditor?

0
Michael Germann
Michael Germann answered on Apr 19, 2011 7:32 PM

The ideal setup for UIAutomation testing is to always start with the same stable start, and the test is to make sure you always end with the expected output. If your input test data is in flux, it will likely throw off your expected testable outcome.

   That being said, ideal scenarios are not what we are always given. My first thought would be if you have filtering available, apply a filter to the desired value, such that there is only one possible outcome, and select that row.

If filtering is not available, my next thought would be just loop through the rows until you get to the desired row. Being you are up to 800+ rows, that may not be the best scenario.

Being there are a lot of rows, and the data is sorted, perhaps you can use a recursive searching method. There are several ways you can go about it. But one concept would be something like below.

In a nutshell, it takes in a row to start from and the total number of rows, it finds the middle value, determines if it is the cell value it is looking for, equal, greater than or less than. If it's equal, it found it's row, in the other two cases, it calls itself, adjusting the starting row and row count accordingly. I also added an additional check, to the rowcount is below a certain number, just brute force through the rows one at a time. If it finds the row, it returns it's row number, if not it returns a -1. Note the logic will need to be changed if the sort is descending.

Set Grid = SwfWindow("Form1").SwfTable("ultraGrid1")
iTest = GetRowToSelect(Grid, "name", "Name for Row#86", 0, Grid.RowCount)

If iTest <> -1 Then
    Grid.SelectRow CStr(iTest)   
else
    msgbox "NotFound"
End If

Function GetRowToSelect(oGrid, sColName, oCellValue, iStartRow, iRowCount)
   dim oCrntCellVal, iNewStartRow, iNewRowCount, iMidShift, iMidRow

    If iRowCount < 6 Then
        For i = iStartRow to iStartRow + iRowCount
                oCrntCellVal = oGrid.GetCellData(CSTR(i), sColName)
                If oCrntCellVal = oCellValue Then
                    GetRowToSelect = i
                    Exit function
                End If
        Next
    Else
        iMidShift = int(iRowCount / 2)
        iMidRow =  iMidShift + iStartRow
        oCrntCellVal = oGrid.GetCellData(CSTR(iMidRow), sColName)
        If oCrntCellVal = oCellValue Then
            GetRowToSelect = iMidRow
            Exit function
        elseif oCrntCellVal > oCellValue Then
            iNewStartRow = iStartRow
            iNewRowCount =     iMidShift
        elseif oCrntCellVal < oCellValue Then
            iNewStartRow = iMidRow + 1
            iNewRowCount = iRowCount – iMidShift
        End If

        GetRowToSelect  = GetRowToSelect(oGrid, sColName, oCellValue, iNewStartRow, iNewRowCount)
        If GetRowToSelect <> -1 Then
            Exit Function
        End If
    End If

    GetRowToSelect = -1
End Function