Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
310
UltraWinGrid - Cannot access basic properties or methods
posted

Hi there, I'm currently running on a trial license (of both QTP and TestaAdvantage) so I hope someone can help me quickly!

I am running QTP 9.5 with the .NET add-in; TestAdvantage 2008V1 CLR2, and the application I am testing is written in C# and using NetAdvantage 2008v1 CLR2, so the versions of test and net advantage do matchup.

Here's my problem: I want to be able to retrieve a value from a cell within an UltraWinGrid, when I record a simple click on a cell, QTP records this:

SwfWindow("EMS - Tomi").SwfObject("SwfObject").PaneActivate "Positions"
SwfWindow("EMS - Tomi").SwfTable("grid").ActivateRow "10"
SwfWindow("EMS - Tomi").SwfTable("grid").ActivateCell "10","Futures"
SwfWindow("EMS - Tomi").SwfTable("grid").SelectCell "10","Futures"

When I immediately replay this script, I get an error on the second line (ActivateRow), this error says simply 'General Run Error' and then lists the line in error. Then if I 'skip', the following two lines also throw back the same error. I can seem to access various properties of the grid in a slightly different fashion, for example when I write a script like this (copied from a bit of code that is in one of the samples provided with TestAdvantage):

Dim grid
Set grid = SwfWindow("EMS - Tomi").SwfTable("grid").Object
Set col  = grid.DisplayLayout.Bands.getItem(0).Columns.getItem(0)
msgbox col

'col' in this case DOES return a value no problems. The only thing is that I am not familiar with the syntax when using the 'Object' method of getting properties, so I don't know if I can access or even set cell properties using this method (The help doesn't seem to provide any examples), and ideally I would like to get to the bottom of why a simple method such as ActivateCell is causing an error.

Does anyone have any ideas?

Many thanks, Ryan.

Parents
No Data
Reply
  • 310
    posted

    Hmmm, an interesting twist to the story: When I record an interaction with a different application (this one being a 'test' app and is much simpler in the sense that the grid is not contained within a large heirachy of containers) and replay that, then I CAN subsequently successfully replay the script in my first post!

    It seems that whenever I restart QTP, I have to interact with this other application first before my recorded scripts work with my original application I am actually trying to test. Bizarre. I would like to try and find a solution that doesn't involve me having to interact with this other app before I can run my tests.

    Cheers, Ryan

Children