Hello All,
QTP Version : 9.2Add -ins - .Net,WPF, Infragistics TestAdvantage
While working with a SWftable, for the first time it executes without a issue while the same code in the action repeated throws the error "Object REference not set to a instance". Here is the code,
rows=Browser("BRW").Window("Win").swftable("tbl").object.rows
for r=0 to rows-1
user_val=Browser("BRW").window("win").swftable("tbl").getcelldata(Cint(r),"EntryName")Next
It throws the error when it reaches user_val. Is there a alternative for getcelldata ?? IF i can use the object properties to retrieve the cell data it would be wonderful.
I tried swftable().object.rows(1).cells(0).value and it did not work.
Can anyone please take a look at it ??
Warm Regards,
Robert
Hello Amar,
I dont think there is anything different about the grid. Initially i had the same thought that this could be a bug, but the below try yielded a positive result. It got me working and in the future if this fails then sure i will log it at the support site as a bug. Thanks a million for looking into the issue and for your prompt replies. You are a BIG help for all those who are waiting for a clue.
rows=Browser("BRW").Window("Win").swftable("tbl").object.rowsfor r=0 to rows-1 user_val=Browser("BRW").window("win").swftable("tbl").Object.Rows.Item(Cint(r)).Cells.Item(3).ValueNext
Try
GetNAProperty("Rows.Count")
Does that throw an error? Is there something special about this grid? does it have FilterRow, is it grouped by, Is it filtered? There are many reasons why GetNAProperty may throw an null reference exception, for example if the specified row is not a data row it will not have Cells collection.
I suggest you create a sample application (or ask your developer to do that) and contact Infragistics developer support. This might be a bug, or maybe we just need to fine tune the parameter that we are passing to the GetNAProperty.
It will also help if you can send me a screenshot for the grid and highlight the row, or cell you are trying to get. also record selecting a row and a cell and send me the recorded script. That should give me an idea about the structure behind this grid
Regards,
Ammar
Hello Ammar,
Oops !! I am sorry...i missed to include Count. I tried with the GetNAProperty but still it throws the same error message stating " Object Reference Not set to a instance of an object".
Thank you very much for the quick response.
Hi Rebert,
I noticed that you are using ".Object.Rows" you should use ".Object.Rows.Count" instead
If that did not work you can try the GetNAProperty here how to do it:
rows=Browser("BRW").Window("Win").swftable("tbl").GetNAProperty("Rows.Count")
Cell_val=Browser("BRW").window("win").swftable("tbl").GetNAProperty("Rows["+CSTR(r)+"].Cells[EntryName].Value")
Cell_Text=Browser("BRW").window("win").swftable("tbl").GetNAProperty("Rows["+CSTR(r)+"].Cells[EntryName].Text")
Next
I hope that will help,