I'm using QTP 9.2 with TestAdvantage 2006 v2 CLR 1.x and I would like to know how I can determine if a cell in an UltraGrid has a status of "Allow Edit" or "No Edit". Certain cells in the grid of our application should have a status of "Allow Edit" all of the time, while other cells should have a status of "No Edit" only in certain instances, so I'm trying to check those in my test scripts.
I've spied on the grid with the .Net Object Spy and found the following: Display Layout > Bands > 0 > Columns > (Column Name) > Row Layout Column Info > Column > Cell Activation > AllowEdit, which I assume is the property I'm needing, but I'm not sure of the syntax for my test scripts to return that property. Here is an example of my scripts, but I'm obviously doing something wrong as when I message box the second line, I get an empty message:
SwfWindow("Company Name").SwfWindow("Purchase Order for Branch").SwfTable("ultraGrid1").ActivateCell "0","QuantityReceived"
SwfWindow("Company Name").SwfWindow("Purchase Order for Branch").SwfTable("ultraGrid1").GetROProperty ("CellActivation", "AllowEdit")
I've only been using TestAdvantage with QTP for about a year, so any help will be appreciated. Thank you!
Hi Dennis,
Use the following line after "ActivateCell" method call
CellActivation = SwfWindow("Company Name").SwfWindow("Purchase Order for Branch").SwfTable("ultraGrid1").GetNAProperty("ActiveCell.Column.CellActivation")
This return an Enumeration as follow:
AllowEdit = 0,
ActivateOnly = 1,
Disabled = 2,
NoEdit = 3,
Hope that is helpful.
Regards,
Ammar
Hi Ammar,
That worked like a charm. Thank you for your help!
Dennis
Hello,
An exception like "unable to find assembly", typically if it happens it will happen for every action not just GetNAProperty. This exception typically will happen if for some reason you have multiple versions of the assembly loaded or the wrong assembly loaded. IE If you have two versions of the assembly locally and or in the global assembly cache. Either that or if your application has a version of NetAdvantage that does not match TestAdvantage.
I would recommend if you get this exception again, to verify what assemblies are loaded via your application. This can be done via Visual Studio, Debug menu, Attach to Process, and attach to the application. You can see which modules are loaded via Debug menu, Windows, Modules. .
If you do not have VisualStudio on the test machine, you can download the free Microsoft application Process Explorer from systeminternals.com. It can do the same by finding the process in the top pane, and fine the loaded dll's in the lower pane. You will need to make sure the lower pane is set to see dll's via, View Menu, Lower Pane View, DLL's.
What you are looking for is to see what version is loaded NetAdvantage is loaded, and what version TestAdvantage is loaded (QTPServer) and if there are multiple versions of anything loaded. If NetAdvantage and TestAdvantage, you will need to get the version of TestAdvantage to match your application. If multiple versions are loaded, you will have to track where it is loading from and adjust it accordingly.
I hope this helps resolve the exception that you are getting,
I abandonned the previous effort and instead used the method "SetInvalidDataCell" and then verified that a value was not set.
My developers told me that this column was set with Col.CellActivation = Activation.ActivateOnly which allows the user to scroll to the cell, to copy the cell value, but not to change it.
I am running Infragistics testadvantage 2009.1. When I run the syntax
SwfWindow("Optiva").SwfWindow("Project").SwfTable("uwgDataMatrix").ActivateCell "0","FIELD2"
SwfWindow("Optiva").SwfWindow("Project").SwfTable("uwgDataMatrix").GetNAProperty("ActiveCell.Activation")
I get;
Unable to find assembly 'Infragistics2.Win.UltraWinGrid.v9.1, Version=9.1.20091.1000, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb'.
I also tried
GetNAProperty("ActiveCell.Column.CellActivation")
I also got;
Is this a matter of a simple syntax error that I have, because I believe I have what you have?
Other Infragistics methods work.
Does anyone have any suggestions?
After doing some additional investigation and experimentation, I've learned from our developers that ("ActiveCell.Column.CellActivation") can be used to determine the edit status of the cells in a particular column, but ("ActiveCell.Activation") can be used to determine the Edit status of a particular cell. The lines of code look something like this:
SwfWindow("Company").SwfWindow("Purchase Order").SwfTable("ultraGrid1").ActivateCell "0","QuantityReceived"QtyRecCell = SwfWindow("Company").SwfWindow("Purchase Order").SwfTable("ultraGrid1").GetNAProperty("ActiveCell.Activation")MsgBox QtyRecCell
I hope this additional information helps!
If you record selection the item from the list inside the cell then move out of the edited cell you will see that "SetCellData" action will be recorded. This action sets the value property of the grid's cell. There is no action to act on the embedded combo, in fact the embedded combo cannot be added as a test object because its embedded inside the grid cell. However you can try to simulate the action using generic keyboard actions:
SwfWindow("...").SwfTable("ultraGrid1").ActivateRow "1"SwfWindow("...").SwfTable("ultraGrid1").ActivateCell "1","Item"
set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "{F2}"WshShell.SendKeys "{ALT+Down Arrow}"WshShell.SendKeys "..." ' a number of arrow to select the right item, or if the combo support type and auto complete then type the item text you want to selectWshShell.SendKeys "{TAB}" ' to move out of the edited cell so that the next cell Combo is populated.
Hope that will help.