Micro Focus QTP (UFT) Forums

Full Version: FireEvent Method on WebEdit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

My Requirement is as follows...

I have a grid with a webedit to filter the grid. I can filter the grid in two ways, enter the text in webedit and click on Image Filter alternatively I can enter the text in webedit and pass keyboard events like 'OnKeyDown','OnKeyUp','OnKeyPress' etc.,
We are using the second method and it worked in my system. Now when the same script is run on different machine the filtered text entered in webedit vanishes as soon as 'OnKeyUp' Event is fired and grid will be filtered for "" resulting in all the grid records being displayed irrespective of filter. The Code is as follows...

Code:
TempIndex = -1
FilterTextBoxIndex  = 1
Events = "OnKeyUP|OnKeyDown|OnKeyPress"
Set FilterGridObject = ChildWin_GPC2.ChildObjects(TexBoxObj)
For i = 0 to FilterGridObject.Count - 1
    If FilterGridObject(i).getroproperty("x") > 0 Then
        TempIndex = TempIndex + 1
        If FilterTextBoxIndex = TempIndex Then
            FilterGridObject(i).Set strValue
            FilterGridObject(i).Click
            wait(2)
            EntireEventValArray = Split(Events,"|")
            For EventAr = 0 to Ubound(EntireEventValArray)
            FilterGridObject(i).FireEvent EntireEventValArray(EventAr)
                Next
        End If
    End If
Next

As Soon as 'OnKeyUP' Event is fired the value set for the text box vanishes in some machines. Kindly hep me on this. Browser used is IE7